Im trying to setup a connect listener. I am currently using a C# WCF Service that Im hosting on Azure. Im able to hit my service method but the response from docusign is null every time. In the logs, the envelope status xml has values but it is just not sent or not deserialized correctly. Im not sure what I am doing wrong and there doesnt seem to be any solid examples of a SOAP implementation anywhere. Can anyone help? The WSDL can be viewed here http://docusignconnectservice.azurewebsites.net/Service.svc?wsdl
Service Implentation
public string DocuSignConnectUpdate(DocuSignAPI.DocuSignEnvelopeInformation envelopeInformation)
{
string envelopeId = "";
if (envelopeInformation == null) return "Envelope is null";
else return envelopeInformation.EnvelopeStatus.EnvelopeID;
}
Service Contract
[ServiceContract(Namespace = "http://www.docusign.net/API/3.0")]
public interface IService
{
[OperationContract]
[XmlSerializerFormatAttribute]
string DocuSignConnectUpdate(DocuSignAPI.DocuSignEnvelopeInformation envelopeInformation);
[OperationContract]
string HelloWorld(string inputString);
DocuSign log entry
10/6/2014 1:30:12 AM Envelope Data:<?xml version="1.0" encoding="utf-8"?><DocuSignEnvelopeInformation xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.docusign.net/API/3.0"><EnvelopeStatus><RecipientStatuses><RecipientStatus><Type>Signer</Type><Email>email</Email><UserName>Username</UserName><RoutingOrder>1</RoutingOrder><Sent>2014-10-05T17:49:36.58</Sent><DeclineReason xsi:nil="true" /><Status>Sent</Status><RecipientIPAddress /><CustomFields /><AccountStatus>Active</AccountStatus><RecipientId>2a10b0ab-63f1-4df9-9258-36b97b5db120</RecipientId></RecipientStatus></RecipientStatuses><TimeGenerated>2014-10-05T18:30:09.644588</TimeGenerated><EnvelopeID>6d7692e6-3f5c-4889-914f-942b2bd83447</EnvelopeID><Subject> Signature Request on Document</Subject><UserName>Username</UserName><Email>email</Email><Status>Sent</Status><Created>2014-10-05T17:49:35.503</Created> <Sent>2014-10-05T17:49:36.613</Sent><ACStatus>Original</ACStatus><ACStatusDate>2014-10-05T17:49:35.503</ACStatusDate><ACHolder></ACHolder><ACHolderEmail></ACHolderEmail><ACHolderLocation>DocuSign</ACHolderLocation><SigningLocation>Online</SigningLocation><SenderIPAddress>ip </SenderIPAddress><EnvelopePDFHash /><CustomFields /><AutoNavigation>true</AutoNavigation><EnvelopeIdStamping>true</EnvelopeIdStamping><AuthoritativeCopy>false</AuthoritativeCopy><DocumentStatuses><DocumentStatus><ID>1</ID><Name>F_1040.pdf</Name><TemplateName /><Sequence>1</Sequence></DocumentStatus></DocumentStatuses></EnvelopeStatus></DocuSignEnvelopeInformation>
10/6/2014 1:30:12 AM Response: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><DocuSignConnectUpdateResponse xmlns="http://www.docusign.net/API/3.0"><DocuSignConnectUpdateResult>Envelope is null</DocuSignConnectUpdateResult></DocuSignConnectUpdateResponse></s:Body> </s:Envelope>
I think there is problem with your classes for mapping of XML.
You can configure your classes with XML response you have with online tools like http://xmltocsharp.azurewebsites.net/ and use XMLSerializer to parse that XML into object .
Related
Based on the following SOAP XML message how can serialize this xml to serialize and extract all elements within the ReviewCallbackMessage into a single XElement? The SOAP Message coming in is using MTom encoding. I hope someone can shed some light on this. It seems like a flaw within WCF, but maybe it's something w/ my contract settings.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:oasis:names:tc:legalxml:wsdl:WebServicesProfile-Definitions-4.0">
<soapenv:Header/>
<soapenv:Body>
<NotifyCompleteRequestMessage xmlns="urn:oasis:names:tc:legalxml:wsdl:WebServicesProfile-Definitions-4.0">
<SendingMDELocationID xmlns="urn:oasis:names:tc:legalxml:schema:xsd:CommonTypes-4.0">
<IdentificationID xmlns="http://niem.gov/niem/niem-core/2.0"></IdentificationID>
</SendingMDELocationID>
<SendingMDEProfileCode xmlns="urn:oasis:names:tc:legalxml:schema:xsd:CommonTypes-4.0">urn:oasis:names:tc:legalxml:schema:xsd:WebServicesMessaging-2.0</SendingMDEProfileCode>
<ReviewCallbackMessage xmlns="urn:oasis:names:tc:legalxml-courtfiling:schema:xsd:ReviewFilingCallbackMessage-4.0" xmlns:nc="http://niem.gov/niem/niem-core/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<nc:DocumentFiledDate>
<nc:DateTime>2018-06-07T13:55:56.0Z</nc:DateTime>
</nc:DocumentFiledDate>
</ReviewCallbackMessage>
</NotifyCompleteRequestMessage>
</soapenv:Body>
</soapenv:Envelope>
This is the contract method and serializing class I'm using. In reality this should load the complete body into the attribute, but it's only loading the first node SendingMDELocationID. There has to be a way to load the complete xml body into one attribute without serializing the whole xml body since if I remove the SendingMDELocationID and SendingMDEProfileCode from the envelope it gives me exactly what I need which is the ReviewCallbackMessage node + all of it's descendants.
public NotifyCompleteResponse NotifyReviewComplete(NotifyCompleteRequest request)
[System.ServiceModel.MessageContractAttribute(IsWrapped = false)]
public partial class NotifyCompleteRequest
{
[System.ServiceModel.MessageBodyMemberAttribute(Namespace = "urn:oasis:names:tc:legalxml:wsdl:WebServicesProfile-Definitions-4.0", Order = 0)]
public XElement NotifyFilingReviewCompleteRequestMessage;
public NotifyFilingReviewCompleteRequest()
{
}
}
I have been searching the web for the last 2-3 days and remain unable to figure this one out - so now I come to you guys in the hopes that you know a solution.
I am trying to make a mocked SOAP service for a client and have made a SOAP service in visual studio. The following is the code for the SOAP action that needs to be mocked.
[WebService(Namespace = "http://mynamespace.com/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
public class MyServiceStub1 : System.Web.Services.WebService, MyServiceBindingSoap
{
[WebMethod]
[SoapDocumentMethod(Action = "http://mynamespace.com/MySoapAction",
ParameterStyle = SoapParameterStyle.Bare)]
[return: System.Xml.Serialization.XmlElementAttribute("SomeWrapperXML")]
public MyActualResponseType MyServiceRequest(
[XmlElement(ElementName = "MyRequestName")] MyServiceRequestType myServiceRequest)
{
return new MyActualResponseType();
}
And I get the following response
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<SomeWrapperXML">
<MyActualResponseType>
</MyActualResponseType>
</SomeWrapperXML>
</soap:Body>
</soap:Envelope>
However, my clients expect the response to look like this
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<MyActualResponseType>
</MyActualResponseType>
</soap:Body>
</soap:Envelope>
And since I cannot change the code on my clients side, I have to fix this from my side. Is there any way I can avoid getting the XML tag "SomeWrapperXML" in my response?
Setting XmlElementAttribute("") did not help and avoiding it altogether will just make it default to something else.
I have also looked at the MSDN post for altering the SOAP message, but that solution seems a bit hacky.
I ended up changing the return type of my mocked service to a field in the original return type.
In my example I needed to return the type MyActualResponseType according to the code generated by svcutil. However MyActualResponseType only contained one field/getter for a type MyActualResponse. I changed my SOAP method to this:
[WebMethod]
[SoapDocumentMethod(Action = "http://mynamespace.com/MySoapAction",
ParameterStyle = SoapParameterStyle.Bare)]
[return: System.Xml.Serialization.XmlElementAttribute("MyActualResponseType")]
public MyActualResponse MyServiceRequest(
[XmlElement(ElementName = "MyRequestName")] MyServiceRequestType myServiceRequest)
{
return new MyActualResponse();
}
Notice the [return: which makes it look like it is actually returning the type MyActualResponseType.
This solution still feels like a bit of hack, but it seems to work fine for my needs.
I am calling a Java WebLogic web service from my .Net application. I have added a service reference to the jws service.
The service can be called fine and I can see the response in Fiddler, however the problem is that the propery listOfHolds is coming as null although I can see a list of holds in the XML of the response.
Here is the code for calling
holdsList result = proxy.viewHoldsList(request.AccountNo);
int noOfHolds = result.NumberOfHolds; // This value is read fine
object[] holds = result.listOfHolds; // This is coming as Null despite the values in the response
Here is the response XML as captured by Fiddler
<?xml version='1.0' encoding='UTF-8'?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Header>
<work:WorkContext xmlns:work="http://oracle.com/weblogic/soap/workarea/">rO0...AAA</work:WorkContext>
</S:Header>
<S:Body>
<ns0:viewHoldsListResponse xmlns:ns0="http://www.openuri.org/">
<ns0:viewHoldsListResult>
<ns0:TotalAmount>130.0</ns0:TotalAmount>
<ns0:NumberOfHolds>4</ns0:NumberOfHolds>
<ns0:listOfHolds>
<ns0:item xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns0:holdDetails">
<ns0:xsiType>HoldDetails</ns0:xsiType>
<ns0:Amount>100.0</ns0:Amount>
<ns0:StartDate>2014-02-15T00:00:00.0</ns0:StartDate>
<ns0:ExpiryDate>2014-02-20T00:00:00.0</ns0:ExpiryDate>
<ns0:Description>For testing</ns0:Description>
<ns0:Instruction/>
<ns0:Tracer>00000810000287294002</ns0:Tracer>
<ns0:HoldId>3591376655</ns0:HoldId>
<ns0:EmployeeId>0</ns0:EmployeeId>
</ns0:item>
<ns0:item xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns0:holdDetails">
<ns0:xsiType>HoldDetails</ns0:xsiType>
<ns0:Amount>10.0</ns0:Amount>
<ns0:StartDate>2014-02-15T00:00:00.0</ns0:StartDate>
<ns0:ExpiryDate>2014-02-17T00:00:00.0</ns0:ExpiryDate>
<ns0:Description>DESC</ns0:Description>
<ns0:Instruction/>
<ns0:Tracer>00000810000287294004</ns0:Tracer>
<ns0:HoldId>3591376656</ns0:HoldId>
<ns0:EmployeeId>0</ns0:EmployeeId>
</ns0:item>
</ns0:listOfHolds>
</ns0:viewHoldsListResult>
</ns0:viewHoldsListResponse>
</S:Body>
</S:Envelope>
I have faced a similar problem before and the problem was a missing xmlns attribute on one of the tags. In this case I am suspecting the extra <ns0:xsiType>HoldDetails</ns0:xsiType> tag that is coming under the <ns0:item> tag.
Update Even after the web service provider removed the extra <xsiType> tag, I am unable to read the listOfHolds.
My questions are:
Can I do anything in my .Net code so that I get the intended value for listOfHolds?
Can I suggest any change to the owner of the Java web service?
[Optional] Why NumberOfHolds is being successfully read from the response but not listOfHolds?
The vendor of the web service has made a change. They changed xsi:type="ns0:holdDetails" to xsi:type="ns0:HoldDetails" (H instead of h).
The point is in Java, and unlike .Net as far as I can tell, they have a control over the generated XML from the web service.
How can i get soap messages posted on IP say 12.23.421.12:3759
is there any way that soap messages on this IP can be read and data can be parsed from XML.
this is the log from WIRESHARK tool, i need to parse this
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlso ap.org/soap/encoding/"
xmlns:xsi ="http://www.w3.org/2001/XMLSche ma-instance"
xmlns:xsd="http://w ww.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<huawei:setSubscriberDetails xmlns:huawei="http://business.add.gsm.rcom.com">
<paramSubscriberDetails>
<IMEI>355030005026 8312</IMEI>
<IMSI >405828210239016</IMSI>
<prepaid>true</prepaid>
<MSISDN>919646845889</MSISDN>
</paramSubscriberDetails>
</huawei:setSubscriberDetails>
</SOAP-ENV:Body>
Try to add an Service Reference to your project. This creates a class and some methods that you can use to call the soap service.
If you receive just the Soap message load it in XDocument using the Load method.
because it is XML you can get your information by doing
var xDoc = XDocument.Load("http://yourserver.com/yourservice/1");
var body = xDoc.Element("SOAP-ENV:Body");
var huaweiSubscriberDetails = new HuaweiSubscriberDetails(){
Imei = body.Element("IMEI").Value,
Imsi = body.Element("IMSI").Value,
etc...
}
I just did this out of my head without Visual Studio so don't pin me down on it, if it contains errors.
I think you need TCP Listener install on your IP:Port
TcpListener MSDN
usually SOAP Response back to caller address (SOAP Request). You do not need a TcpListener if SOAP Request coming from you. It's my guess :)
I'm having some problems with one webservice that i'm working with. I generated a proxy class with wsdl.exe that comes with .net framework. But that webservice return a header that isnt not mapped by the wsdl. I must map the header sop because it contains some properties that i have to read and work with. how can i read the soap's header collection?
Ex.:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header xmlns="http://xml.amadeus.com/ws/2009/01/WBS_Session-2.0.xsd">
<Session>
<SessionId>545784545</SessionId>
<SequenceNumber>1</SequenceNumber>
<SecurityToken>asd7a87sda89sd45as4d5a4</SecurityToken>
</Session>
</soap:Header>
<soap:Body>
<TAM_Altea_Seguranca_AutenticarRS xmlns="http://xml.amadeus.com/2009/04/TAM/TAM_Altea_Seguranca_AutenticarRS_2.0">
<statusDoProcesso>
<codigoDoStatus>P</codigoDoStatus>
</statusDoProcesso>
</TAM_Altea_Seguranca_AutenticarRS>
</soap:Body>
</soap:Envelope>
I need to read the SOAP:HEADER -> Session.
Have you tried this?
source: Handle SOAP Headers Required by an XML Web Service Client
public class MyWebService
{
public SoapUnknownHeader[] unknownHeaders;
[WebMethod]
[SoapHeader("unknownHeaders")]
public string MyWebMethod()
{
foreach (SoapUnknownHeader header in unknownHeaders)
{
// process headers
}
// handle request
}
}
See this page for detailed instructions on defining custom SOAP headers. There only seem to be VB.net code examples, but it should be easy enough to translate the principles in C#.