We insisted one of our vendors provide a web service interface, but they are
a PHP shop and barely cobbled together a service, without WSDL. So I hacked
together a WSDL, which seems mostly right, except the generated reference.cs
says the results array consists of one null element. I used a sniffer to
detect the returning SOAP envelope. It looks OK, to me. There should be a
valid string in the results. (Together with the vendor we verified that the
call to their service is working correctly. "ERR02" is a valid test result.)
What am I doing wrong? Below are the generated reference.cs method,
returning SOAP envelope, and pertinent lines of the WSDL I hacked together.
reference.cs:
*************
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://soap.vendor.com/create",
RequestNamespace="http://soap.vendor.com",
ResponseNamespace="http://soap.vendor.com",
Use=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return:
System.Xml.Serialization.XmlElementAttribute("outputString")]
public string create(string hid, string src, string fname, string
bname, string domain, string passwd, string email, string tele, string
tzone) {
object[] results = this.Invoke("create", new object[] {
hid,
src,
fname,
bname,
domain,
passwd,
email,
tele,
tzone});
return ((string)(results[0])); //returns with length == 1
(null), I should be recieving "ERR02"
}
The returning SOAP envelope I detected with HTTP sniffer: (Note extra line
break after "<SOAP-ENV:Body>", shouldn't matter, but I'm stumped).
*******************************************************
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns4="http://soap.vendor.com"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns4:createResponse>
<outputString
xsi:type="xsd:string">ERR02</outputString></ns4:createResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Lines from my WSDL that should be invovled in deciphering the returning SOAP
************************************************************
<wsdl:definitions
...
<wsdl:types>
...
<s:element name="createResponse">
<s:complexType >
<s:sequence>
<s:element minOccurs="0" maxOccurs="1"
name="outputString" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
...
</wsdl:types>
...
<wsdl:message name="createSoapOut">
<wsdl:part name="parameters" element="tns:createResponse" />
</wsdl:message>
...
<wsdl:portType name="ApiManagerSoap">
<wsdl:operation name="create">
<wsdl:input message="tns:createSoapIn" />
<wsdl:output message="tns:createSoapOut" />
</wsdl:operation>
...
</wsdl:portType>
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
<wsdl:operation name="create">
<soap:operation soapAction="http://soap.vendor.com/create"
style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
Gaurav Vaish (EduJini.IN) - 25 May 2006 06:26 GMT
I would suggest getting Zend Studio from www.zend.com and use it to work
with WebServices -- it supports generation of WSDL.
Trial version is available for download at:
http://downloads.zend.com/studio/5.1.0/ZendStudio-5_1_0a.exe
You will need to request for a key...

Signature
Happy Hacking,
Gaurav Vaish
http://www.mastergaurav.org
http://www.edujini.in
-------------------
> We insisted one of our vendors provide a web service interface, but they
> are a PHP shop and barely cobbled together a service, without WSDL. So I
[quoted text clipped - 8 lines]
> returning SOAP envelope, and pertinent lines of the WSDL I hacked
> together.
Jack Fox - 28 May 2006 23:32 GMT
The problem is the way the host web service is formatting the SOAP envelope.
Apparently .NET does not recognize prefixing the namespace to the element
name as follows:
xmlns:ns4="http://soap.vendor.com"
...
<ns4:createResponse>
but requires the namespace to be an attribute of the element tag. It may be
there is some WSDL parameter that will fix this, but what I ended up doing
was writing a SoapExtension class to reparse the SOAP before deserializing
it. The opportunity exists to write a general solution to this problem using
regular expressions (there must be lots of non-MS web services that format
their SOAP this way), but I opted for the quick and dirty solution to my
immediate problem.
> We insisted one of our vendors provide a web service interface, but they
> are a PHP shop and barely cobbled together a service, without WSDL. So I
[quoted text clipped - 98 lines]
> </wsdl:output>
> </wsdl:operation>