Note that there are some explanatory texts on larger screens.

plurals
  1. POConsuming AXIS webservice from .Net Problem
    text
    copied!<p>I have problem with consuming axis (JAVA) web service inside a client C# web application. I have to use third Party web service that works properly with JAVA clients! When we test it with SoapUI it works perfectly. I have added web service and service reference ( asmx and wcf) but both references works same ! I think we have problem with code generated by wsdl.exe (reference.cs) Because it cannot deserialize the response backed from server. I can see SOAP Response in debug mode and I know the response is correct. But we have exception “XML Document Not Well Formed!”, “Root Namespace Is Missing” when Deserialization Process start</p> <p><strong>Response:</strong></p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt; &lt;soapenv:Body&gt; &lt;processRequestResponse xmlns="http://www.mytown.com"&gt; &lt;ETIResponse xmlns=""&gt; &lt;ns1:TransactionID xmlns:ns1="http://www.mytown.com"&gt;CDK11341818404883&lt;/ns1:TransactionID&gt; &lt;ns2:OrigResponseMessage xmlns:ns2="http://www.mytown.com"&gt;.....&lt;/ns2:OrigResponseMessage&gt; &lt;ns3:CommandStatus xmlns:ns3="http://www.mytown.com"&gt;INVALID&lt;/ns3:CommandStatus&gt; &lt;ns4:ResultCode xmlns:ns4="http://www.mytown.com"&gt;21&lt;/ns4:ResultCode&gt; &lt;/ETIResponse&gt; &lt;/processRequestResponse&gt; &lt;/soapenv:Body&gt; &lt;/soapenv:Envelope&gt; </code></pre> <p><strong>WSDL:</strong></p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;wsdl:definitions targetNamespace="http://www.mytown.com" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://www.mytown.com" xmlns:intf="http://www.mytown.com" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; &lt;wsdl:types&gt; &lt;schema targetNamespace="http://www.mytown.com" xmlns="http://www.w3.org/2001/XMLSchema"&gt; &lt;import namespace="http://schemas.xmlsoap.org/soap/encoding/"/&gt; &lt;complexType name="ETIParameter"&gt; &lt;sequence&gt; &lt;element name="key" nillable="true" type="xsd:string"/&gt; &lt;element name="value" nillable="true" type="xsd:string"/&gt; &lt;/sequence&gt; &lt;/complexType&gt; &lt;complexType name="ETIParameters"&gt; &lt;sequence&gt; &lt;element maxOccurs="unbounded" minOccurs="0" name="Parameter" nillable="true" type="impl:ETIParameter"/&gt; &lt;/sequence&gt; &lt;/complexType&gt; &lt;complexType name="ETIRequestType"&gt; &lt;sequence&gt; &lt;element name="RequestMessage" nillable="true" type="xsd:string"/&gt; &lt;element name="ClientID" nillable="true" type="xsd:string"/&gt; &lt;element name="Password" nillable="true" type="xsd:string"/&gt; &lt;element maxOccurs="1" minOccurs="0" name="Parameters" nillable="true" type="impl:ETIParameters"/&gt; &lt;/sequence&gt; &lt;/complexType&gt; &lt;simpleType name="CommandStatusType"&gt; &lt;restriction base="xsd:string"&gt; &lt;enumeration value="OK"/&gt; &lt;enumeration value="SYSTEM-ERROR"/&gt; &lt;enumeration value="SYNTAX-ERROR"/&gt; &lt;enumeration value="INVALID"/&gt; &lt;enumeration value="ERROR"/&gt; &lt;/restriction&gt; &lt;/simpleType&gt; &lt;complexType name="ETIResponseType"&gt; &lt;sequence&gt; &lt;element maxOccurs="1" minOccurs="0" name="TransactionID" nillable="true" type="xsd:string"/&gt; &lt;element name="OrigResponseMessage" nillable="true" type="xsd:string"/&gt; &lt;element maxOccurs="1" minOccurs="0" name="TermResponseMessage" nillable="true" type="xsd:string"/&gt; &lt;element name="CommandStatus" nillable="true" type="impl:CommandStatusType"/&gt; &lt;element name="ResultCode" type="xsd:int"/&gt; &lt;element maxOccurs="1" minOccurs="0" name="ErrorMsg" nillable="true" type="xsd:string"/&gt; &lt;/sequence&gt; &lt;/complexType&gt; &lt;/schema&gt; &lt;/wsdl:types&gt; &lt;wsdl:message name="processRequestRequest"&gt; &lt;wsdl:part name="ETIRequest" type="impl:ETIRequestType"/&gt; &lt;/wsdl:message&gt; &lt;wsdl:message name="processRequestResponse"&gt; &lt;wsdl:part name="ETIResponse" type="impl:ETIResponseType"/&gt; &lt;/wsdl:message&gt; &lt;wsdl:portType name="ETI_Type"&gt; &lt;wsdl:operation name="processRequest" parameterOrder="ETIRequest"&gt; &lt;wsdl:input message="impl:processRequestRequest" name="processRequestRequest"/&gt; &lt;wsdl:output message="impl:processRequestResponse" name="processRequestResponse"/&gt; &lt;/wsdl:operation&gt; &lt;/wsdl:portType&gt; &lt;wsdl:binding name="ETICoreSoapBinding" type="impl:ETI_Type"&gt; &lt;wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/&gt; &lt;wsdl:operation name="processRequest"&gt; &lt;wsdlsoap:operation soapAction="capeconnect:ETI_WebService:ETI_Type#processRequest"/&gt; &lt;wsdl:input name="processRequestRequest"&gt; &lt;wsdlsoap:body namespace="http://www.mytown.com" use="literal"/&gt; &lt;/wsdl:input&gt; &lt;wsdl:output name="processRequestResponse"&gt; &lt;wsdlsoap:body namespace="http://www.mytown.com" use="literal"/&gt; &lt;/wsdl:output&gt; &lt;/wsdl:operation&gt; &lt;/wsdl:binding&gt; &lt;wsdl:service name="ETI_WebService"&gt; &lt;wsdl:port binding="impl:ETICoreSoapBinding" name="ETICore"&gt; &lt;wsdlsoap:address location="https://X.X.X.X/banks/services/ETICore"/&gt; &lt;/wsdl:port&gt; &lt;/wsdl:service&gt; &lt;/wsdl:definitions&gt; </code></pre> <p><strong>Response Section From Reference.cs</strong></p> <pre><code> [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://www.mytown.com")] public partial class ETIResponseType { private string transactionIDField; private string origResponseMessageField; private string termResponseMessageField; private string commandStatusField; private int resultCodeField; private string errorMsgField; /// &lt;remarks/&gt; [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = true)] public string TransactionID { get { return this.transactionIDField; } set { this.transactionIDField = value; } } /// &lt;remarks/&gt; [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = true)] public string OrigResponseMessage { get { return this.origResponseMessageField; } set { this.origResponseMessageField = value; } } /// &lt;remarks/&gt; [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = true)] public string TermResponseMessage { get { return this.termResponseMessageField; } set { this.termResponseMessageField = value; } } /// &lt;remarks/&gt; [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = true)] public string CommandStatus { get { return this.commandStatusField; } set { this.commandStatusField = value; } } /// &lt;remarks/&gt; [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] public int ResultCode { get { return this.resultCodeField; } set { this.resultCodeField = value; } } /// &lt;remarks/&gt; [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = true)] public string ErrorMsg { get { return this.errorMsgField; } set { this.errorMsgField = value; } } } </code></pre> <p>I know we have problem with namespaces and namespace prefix and generated Code if we add WCF Reference we get clear Exception Message:</p> <pre><code>There was an error in serializing body of message : 'There was an error generating the XML document.'. Please see InnerException for more details. The prefix '' is bound to the namespace '' and cannot be changed to 'http://www.mytown.com'. </code></pre> <p>Any Comments or Help? </p> <p>Thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload