Webservice receives 0 length array instead of data its invoked with

J

joey.edelstein

Hi,
I created a .Net web service by compiling a WSDL file with "WSDL
/server" then implementing the resulting abstract class.
Relevant sections of the WSDL are a the bottom of this message.

When I call the web service using SOAP Scope or by code, no matter what
values I give for for optional parameters it receives a 0 length array
for the AppType parameter instead of the expected data.

The same web service implemented using gSOAP works fine.

Any advice would be appreciated.
Thanks
Joey


(snip)
<xs:element name="CbPolicyDisable">
<xs:complexType>
<xs:sequence>
<xs:element name="HardwareID" type="xs:unsignedInt"
minOccurs="0"/>
<xs:element name="AppType" type="cb:CircuitBreakerApplicationType"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
(snip)
<xs:simpleType name="CircuitBreakerApplicationType">
<xs:restriction base="xs:unsignedByte">
<xs:enumeration value="0">
<xs:annotation>
<xs:documentation>"thing"</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="1">
<xs:annotation>
<xs:documentation>"other thing"</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="2">
<xs:annotation>
<xs:documentation>"one last thing"</xs:documentation>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
 
J

Jimbo

Hi,
I created a .Net web service by compiling a WSDL file with "WSDL
/server" then implementing the resulting abstract class.
Relevant sections of the WSDL are a the bottom of this message.

When I call the web service using SOAP Scope or by code, no matter what
values I give for for optional parameters it receives a 0 length array
for the AppType parameter instead of the expected data.

What are you using as the SOAP client? If the SOAP message isn't exactly
right then you get 0 data back.

Have you tried using the .NET web service test page. Just point your web
browser at the web service. For example:

http://localhost.localdomain/WebService/Service1.asmx

Hope this helps
Jimbo
 
J

joey.edelstein

Hi Jimbo,
Thank you for your response.
I have been using SOAPScope. I believe it formats the message
correctly.
The data isn't in the response. It is being delivered to the web
service as length 0.
The .Net web service test page doesn't seem to work at all for some
reason.
Thanks
Joey
 
J

joey.edelstein

We figured it out here is the answer.
The WSDL compiles to the following C# function prototype:
[System.Xml.Serialization.XmlIgnoreAttribute()] bool
HardwareIDSpecified,
[System.Xml.Serialization.XmlElementAttribute("AppType")] System.Byte[]
AppType);

Notice the enumeration is a basic type so C# truns the AppType
parameter in to Byte and since it's an array its Byte[]

BUT - if you look at the WSDL the service publishes it claims the
parameter is a xsd:base64Binary which is the type WSDL uses for Byte[].

So - the implicit WSDL for the service doesn't match the explicit WSDL
we started with causing plenty of confusion.

Solution/workaround - we changed the enumeration to be of type
unsignedShort and now all is well

Hope this helps somebody
Joey
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top