I've been tasked with consuming a Perl web service that was written by a
person in a different department of my company. The problem is it's the
guy's first attempt at web services and he doesn't know how to create the
WDSL. I created web service with Visual Studio that mimics his service and
after some tweaking of the soapAction in the WSDL I'm able to call his
service successfully. When I use SOAPScope to look the messages being sent
and received the data is there although my response objects are always null
and I think it's a namespace problem. The Perl web service seems to return a
random namespace every time. If you look at the getURLResponse node in the
XML below you see that the namespace is 'namesp4' and this is different
every time. Is there anyway to change the WSDL to accommodate this? I've
also pasted the WSDL below Any help would be greatly appreciated!
Thanks
RESPONSE:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:xsi="http ://www.w3.org/1999/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap .org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap .org/soap/envelope/"
xmlns:xsd="http ://www.w3.org/1999/XMLSchema"
SOAP-ENV:encodingSty le="http://schemas.xmlsoap .org/soap/encoding/">
<SOAP-ENV:Body>
<namesp4:getURL Response xmlns:namesp4=" urn:/SOAP_URLList">
<url>
<profile xsi:type="xsd:s tring">custom1</profile>
<position xsi:type="xsd:i nt">1</position>
<action xsi:type="xsd:i nt">1</action>
<url xsi:type="xsd:s tring">http://www.ebay.com</url>
<id xsi:type="xsd:i nt">124</id>
<enabled xsi:type="xsd:i nt">1</enabled>
</url>
</namesp4:getURLR esponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
REQUEST:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelop e xmlns:soap="htt p://schemas.xmlsoap .org/soap/envelope/"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema">
<soap:Body>
<getURL xmlns="urn:/SOAP_URLList">
<id>124</id>
</getURL>
</soap:Body>
</soap:Envelope>
WSDL:
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitio ns xmlns:http="htt p://schemas.xmlsoap .org/wsdl/http/"
xmlns:soap="htt p://schemas.xmlsoap .org/wsdl/soap/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc=" http://schemas.xmlsoap .org/soap/encoding/"
xmlns:tns="urn:/SOAP_URLList"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:mime="htt p://schemas.xmlsoap .org/wsdl/mime/"
xmlns:wsdl="htt p://schemas.xmlsoap .org/wsdl/"
targetNamespace ="urn:/SOAP_URLList">
<wsdl:types>
<s:schema elementFormDefa ult="qualified"
targetNamespace ="urn:/SOAP_URLList">
<s:element name="addURL">
<s:complexTyp e>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1"
name="profile" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1"
name="url" type="s:string"/>
<s:element minOccurs="1" maxOccurs="1"
name="action" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1"
name="position" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1"
name="enabled" type="s:int"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="addURLRes ponse">
<s:complexTyp e>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1"
name="addURLRes ult" type="s:int"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="updateURL ">
<s:complexTyp e/>
</s:element>
<s:element name="updateURL Response">
<s:complexTyp e>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1"
name="updateURL Result" type="s:int"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="getURL">
<s:complexTyp e>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1"
name="id" type="s:int"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="getURLRes ponse">
<s:complexTyp e>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1"
name="getURLRes ult" type="tns:url"/>
</s:sequence>
</s:complexType>
</s:element>
<s:complexTyp e name="url">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1"
name="profile" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1"
name="action" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1"
name="url" type="s:string"/>
<s:element minOccurs="1" maxOccurs="1"
name="id" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1"
name="enabled" type="s:int"/>
</s:sequence>
</s:complexType>
<s:element name="delURL">
<s:complexTyp e/>
</s:element>
<s:element name="delURLRes ponse">
<s:complexTyp e>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1"
name="delURLRes ult" type="s:int"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="listURLs" >
<s:complexTyp e/>
</s:element>
<s:element name="listURLsR esponse">
<s:complexTyp e>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1"
name="listURLsR esult" type="tns:Array OfUrl"/>
</s:sequence>
</s:complexType>
</s:element>
<s:complexTyp e name="ArrayOfUr l">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbo unded"
name="url" type="tns:url"/>
</s:sequence>
</s:complexType>
</s:schema>
</wsdl:types>
<wsdl:message name="addURLSoa pIn">
<wsdl:part name="parameter s" element="tns:ad dURL"/>
</wsdl:message>
<wsdl:message name="addURLSoa pOut">
<wsdl:part name="parameter s" element="tns:ad dURLResponse"/>
</wsdl:message>
<wsdl:message name="updateURL SoapIn">
<wsdl:part name="parameter s" element="tns:up dateURL"/>
</wsdl:message>
<wsdl:message name="updateURL SoapOut">
<wsdl:part name="parameter s" element="tns:up dateURLResponse "/>
</wsdl:message>
<wsdl:message name="getURLSoa pIn">
<wsdl:part name="parameter s" element="tns:ge tURL"/>
</wsdl:message>
<wsdl:message name="getURLSoa pOut">
<wsdl:part name="parameter s" element="tns:ge tURLResponse"/>
</wsdl:message>
<wsdl:message name="delURLSoa pIn">
<wsdl:part name="parameter s" element="tns:de lURL"/>
</wsdl:message>
<wsdl:message name="delURLSoa pOut">
<wsdl:part name="parameter s" element="tns:de lURLResponse"/>
</wsdl:message>
<wsdl:message name="listURLsS oapIn">
<wsdl:part name="parameter s" element="tns:li stURLs"/>
</wsdl:message>
<wsdl:message name="listURLsS oapOut">
<wsdl:part name="parameter s" element="tns:li stURLsResponse"/>
</wsdl:message>
<wsdl:portTyp e name="SOAP_URLL istSoap">
<wsdl:operati on name="addURL">
<wsdl:input message="tns:ad dURLSoapIn"/>
<wsdl:output message="tns:ad dURLSoapOut"/>
</wsdl:operation>
<wsdl:operati on name="updateURL ">
<wsdl:input message="tns:up dateURLSoapIn"/>
<wsdl:output message="tns:up dateURLSoapOut"/>
</wsdl:operation>
<wsdl:operati on name="getURL">
<wsdl:input message="tns:ge tURLSoapIn"/>
<wsdl:output message="tns:ge tURLSoapOut"/>
</wsdl:operation>
<wsdl:operati on name="delURL">
<wsdl:input message="tns:de lURLSoapIn"/>
<wsdl:output message="tns:de lURLSoapOut"/>
</wsdl:operation>
<wsdl:operati on name="listURLs" >
<wsdl:input message="tns:li stURLsSoapIn"/>
<wsdl:output message="tns:li stURLsSoapOut"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SOAP_URLL istSoap" type="tns:SOAP_ URLListSoap">
<soap:binding style="document "
transport="http ://schemas.xmlsoap .org/soap/http"/>
<wsdl:operati on name="addURL">
<soap:operati on soapAction="urn :/SOAP_URLList#ad dURL"
style="document "/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operati on name="updateURL ">
<soap:operati on soapAction="urn :/SOAP_URLList#up dateURL"
style="document "/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operati on name="getURL">
<soap:operati on soapAction="urn :/SOAP_URLList#ge tURL"
style="document "/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operati on name="delURL">
<soap:operati on soapAction="urn :/SOAP_URLList#de lURL"
style="document "/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operati on name="listURLs" >
<soap:operati on soapAction="urn :/SOAP_URLList#li stURLs"
style="document "/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="SOAP_URLL ist">
<documentatio n xmlns="http://schemas.xmlsoap .org/wsdl/"/>
<wsdl:port name="SOAP_URLL istSoap"
binding="tns:SO AP_URLListSoap" >
<soap:address location="http://eng-dev:9000"/>
</wsdl:port>
</wsdl:service>
</wsdl:definition s>
TEST CODE:
Dim ws As New SOAP_URLList.SO AP_URLList
Try
Dim url As SOAP_URLList.ur l = ws.getURL(124)
Dim sf As New _
Serialization.X mlSerializer(Ge tType(SOAP_URLL ist.url))
Dim sXML As StringWriter = _
New StringWriter(Ne w System.Text.Str ingBuilder)
sf.Serialize(sX ML, url)
Me.txtResponse. Text = sXML.ToString
Catch ex As SoapException
MsgBox(ex.ToStr ing)
Me.txtResponse. Text = ex.ToString
End Try
Returns:
<?xml version="1.0" encoding="utf-16"?>
<url xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />