I'm using Visual Studio 2005/C# to build a web client. The web server
is something I've written in a different framework, which does not
support generating wsdl, so I have hand-built a wsdl file, then
created my proxy class by running wsdl.exe. The problem is that the
SOAP message that the client generates contains an empty namespace for
the parameters in my message, instead of the namespace I intended it
to have. I am guessing it is some sort of problem in my wsdl, could
any of you wsdl/.NET experts take a look and see if you can identify
what I have done wrong?
First of all, here is my wsdl file:
--------------START OF WSDL-------------------
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://
www.w3.org/2001/XMLSchema" xmlns:http="http://schemas.xmlsoap.org/wsdl/
http/" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:xtml="http://
www.foobar.com/schemas/common" xmlns:cnf="urn:com.foo.bar"
targetNamespace="urn:com.foo.bar">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://
www.foobar.com/schemas/common">
<s:element name="TrxnID">
<s:simpleType>
<s:restriction base="s:string"/>
</s:simpleType>
</s:element>
<s:element name="src-sessionID">
<s:simpleType>
<s:restriction base="s:string"/>
</s:simpleType>
</s:element>
<s:element name="dst-sessionID">
<s:simpleType>
<s:restriction base="s:string"/>
</s:simpleType>
</s:element>
</s:schema>
<s:schema elementFormDefault="qualified"
targetNamespace="urn:com.foo.bar">
<s:simpleType name="tStatus">
<s:restriction base="s:string"/>
</s:simpleType>
<s:simpleType name="tPhoneNumber">
<s:restriction base="s:string"/>
</s:simpleType>
</s:schema>
</wsdl:types>
<wsdl:message name="RequestHeader">
<wsdl:part name="TrxnID" element="xtml:TrxnID"/>
<wsdl:part name="dst-sessionID" element="xtml:dst-sessionID"/>
</wsdl:message>
<wsdl:message name="ResponseHeader">
<wsdl:part name="TrxnID" element="xtml:TrxnID"/>
<wsdl:part name="src-sessionID" element="xtml:src-sessionID"/>
</wsdl:message>
<wsdl:message name="OutdialRequest">
<wsdl:part name="callingNumber" type="cnf:tPhoneNumber"/>
<wsdl:part name="calledNumber" type="cnf:tPhoneNumber"/>
<wsdl:part name="passCode" type="s:string"/>
</wsdl:message>
<wsdl:message name="OutdialResponse">
<wsdl:part name="status" type="cnf:tStatus"/>
</wsdl:message>
<wsdl:portType name="ConferencePort">
<wsdl:operation name="OutdialOperation">
<wsdl:input message="cnf:OutdialRequest"/>
<wsdl:output message="cnf:OutdialResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ConferenceSOAPBinding" type="cnf:ConferencePort">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/
http"/>
<wsdl:operation name="OutdialOperation">
<soap:operation soapAction="urn:com.foo.bar"/>
<wsdl:input>
<soap:body use="literal" namespace="urn:com.foo.bar"
wsdl:required="true"/>
<soap:header message="cnf:RequestHeader" part="TrxnID"
use="literal"/>
<soap:header message="cnf:RequestHeader" part="dst-sessionID"
use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal" namespace="urn:com.foo.bar"
wsdl:required="true"/>
<soap:header message="cnf:ResponseHeader" part="TrxnID"
use="literal"/>
<soap:header message="cnf:ResponseHeader" part="src-sessionID"
use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ConferenceService">
<wsdl:port name="Conferencing" binding="cnf:ConferenceSOAPBinding"/>
</wsdl:service>
</wsdl:definitions>
--------------END OF WSDL-------------------
and here is what the generated SOAP message looks like:
-------------START OF GENERATED SOAP REQUEST------------
<?xml version="1.0" encoding="utf-8"?>
<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:Header>
<TrxnID xmlns="http://www.foobar.com/schemas/common">1234</TrxnID>
</soap:Header>
<soap:Body>
<OutdialOperation xmlns="urn:com.foo.bar">
<callingNumber xmlns="">781</callingNumber>
<calledNumber xmlns="">784</calledNumber>
<passCode xmlns="">1234</passCode>
</OutdialOperation>
</soap:Body>
</soap:Envelope>
-------------END OF GENERATED SOAP REQUEST--------------
The problem is that I wanted the parameters in my message, like
'callingNumber', to be associated with the namespace
"urn:com.foo.bar", but as you can see they are associated with a blank
namespace.
Any idea what I am doing wrong? It must be a problem with my wsdl,
right? Can anyone suggest how I modify that wsdl to correctly
indicate that the parameters in my request message above are
associated with that namespace?