Hi,
I've been trying like a madman to make my WSDL work with .net, but it
seems I am out of luck. Whenever I add a service reference to Visual
C#, the code gets generated fine, however all operations miss their
parameters, which is very weird. I have stripped down the WSDL to an
example of a singe simple function. Before I post all the WSDL, here
is what I tried. I loaded the WSDL using the "add service reference"
function. I got code like this:
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("Sy stem.ServiceModel",
"3.0.0.0")]
public partial class simpleServicePortTypeClient :
System.ServiceModel.ClientBase<SimpleTest.HelloSer vice.simpleServicePortType>,
SimpleTest.HelloService.simpleServicePortType {
...
public void hello() {
base.Channel.hello();
}
...
}
I would have expected something like
public HelloOutput hello(String username, String password,
String foo, String bar) {
}
or maybe
public HelloOutput hello(HelloInput helloInput) {
}
I got no error messages whatsoever, neither did svcutil place some
comments into the generated code stating some problem. I also tried the
svcutil.exe command line, which yields the exact same result.
Here is the WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<!--simple Service Interface: v1.5, 01.09.2008-->
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
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:tns="http://service.simple.example.com"
xmlns:ns="http://service.simple.example.com"
xmlns:ns1="http://shared.simple.example.com"
targetNamespace="http://service.simple.example.com">
<wsdl:import namespace="http://service.simple.example.com"
location="simple-service-types.xsd"/>
<wsdl:types>
<xs:schema targetNamespace="http://service.simple.example.com"
elementFormDefault="qualified">
<xs:element name="hello" type="tns:HelloInput"/>
<xs:element name="helloResponse" type="tns:HelloOutput"/>
</xs:schema>
</wsdl:types>
<wsdl:message name="HelloIn">
<wsdl:part name="parameters" element="tns:hello"/>
</wsdl:message>
<wsdl:message name="HelloOut">
<wsdl:part name="parameters" element="tns:helloResponse"/>
</wsdl:message>
<wsdl:portType name="simpleServicePortType">
<wsdl:operation name="hello">
<wsdl:input message="tns:HelloIn"/>
<wsdl:output message="tns:HelloOut"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="simpleServiceBinding" type="tns:simpleServicePortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="hello">
<soap:operation
soapAction="http://service.simple.example.com/beginTimeBasedSession"
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="simpleService">
<wsdl:port name="simpleServicePort" binding="tns:simpleServiceBinding">
<soap:address
location="http://simple.example.com/services/simpleService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
As you might have noticed, I tried to implement document/literal
wrapped style here, so the function Hello uses two elements "hello" and
"helloResponse" for their in- and output messages. I also reference two
XSD files, one with Hello-Specific types and one with generic types:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:shared="http://shared.simple.example.com"
xmlns:service="http://service.simple.example.com"
targetNamespace="http://service.simple.example.com"
elementFormDefault="qualified" attributeFormDefault="qualified">
<!--simple-Service-Types: v1.5, 01.09.2008-->
<xs:import namespace="http://shared.simple.example.com"
schemaLocation="simple-shared-types.xsd"/>
<xs:complexType name="HelloInput">
<xs:complexContent>
<xs:extension base="shared:UserBasedInput"/>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="HelloOutput">
<xs:complexContent>
<xs:extension base="shared:GenericOutput"/>
</xs:complexContent>
</xs:complexType>
</xs:schema>
And:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:shared="http://shared.simple.example.com"
targetNamespace="http://shared.simple.example.com"
elementFormDefault="qualified" attributeFormDefault="qualified">
<!--Generic Complex Types-->
<xs:complexType name="GenericInput">
<xs:annotation>
<xs:documentation>Generic abstract input type for all kinds of
requests</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="foo" type="xs:string" nillable="true"/>
<xs:element name="bar" type="xs:string" nillable="true"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="GenericOutput">
<xs:annotation>
<xs:documentation>Generic abstract output type for all kinds of
requests</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="returncode" type="xs:string" nillable="true"/>
<xs:element name="message" type="xs:string" nillable="true"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="UserBasedInput">
<xs:annotation>
<xs:documentation>Generic abstract input type for all kinds of
requests requiring a user.</xs:documentation>
</xs:annotation>
<xs:complexContent>
<xs:extension base="shared:GenericInput">
<xs:sequence>
<xs:element name="username" type="xs:string"
nillable="true"/>
<xs:element name="password" type="xs:string"
nillable="true"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
Sorry for the somewhat lengthly post, however this was the shortest
example that produced the behaviour. Any ideas on what I am doing wrong
would be greatly appreciated.
Thank you and best regards,
Jan