homepage Welcome to WebmasterWorld Guest from 54.205.59.78
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Visit PubCon.com
Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
Forum Library, Charter, Moderators: ocean10000

Microsoft IIS Web Server and ASP.NET Forum

    
Complex data types not recognized by ASP.NET SOAP clients
leahco




msg:3428164
 6:44 pm on Aug 21, 2007 (gmt 0)

Hello,

I have been working on a SOAP server that returns some complex data types. Here is how I have defined the data types:

require 'nusoap/nusoap.php';

$server = new soap_server();
$NAMESPACE = 'http://www.example.com/services/EorthoContent';
$server->configureWSDL('EorthoContent', $NAMESPACE);
$server->wsdl->schemaTargetNamespace = $NAMESPACE;

// Begin complex type definitions
$server->wsdl->addComplexType(
'ArrayOf_xsd_string',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array('ref'=>'SOAP-ENC:arrayType',
'wsdl:arrayType'=>'xsd:string[]'))
);

// ---- ArrayOf_xsd_string[] (ArrayOfArrayOf_xsd_string) -------------------------------
$server->wsdl->addComplexType(
'ArrayOfArrayOf_xsd_string',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:ArrayOf_xsd_string[]')
),
'tns:ArrayOf_xsd_string'
);

Now, the complex types seem to be received fine when called by a PHP based SOAP client (nusoap or built-in SOAP in php5), but when trying to interpret the complex types in ASP.NET, I get the following error:

[InvalidOperationException: The specified type was not recognized: name='ArrayOf_xsd_string', namespace='http://www.example.com/services/EorthoContent', at <return xmlns=''>.]
System.Xml.Serialization.XmlSerializationReader.GetPrimitiveType(XmlQualifiedName typeName, Boolean throwOnUnknown) +695111
System.Xml.Serialization.XmlSerializationReader.ReadArray(String typeName, String typeNs) +459
System.Xml.Serialization.XmlSerializationReader.ReadReferencingElement(String name, String ns, Boolean elementCanBeType, String& fixupReference) +371
System.Xml.Serialization.XmlSerializationReader.ReadReferencingElement(String name, String ns, String& fixupReference) +14
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderEorthoContentService.Read3_getProvidersResponse() +478
Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer5.Deserialize(XmlSerializationReader reader) +40
System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) +161

[InvalidOperationException: There is an error in XML document (1, 489).]
System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) +637
System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle) +32
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) +1143
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +204
EorthoContentService.getProviders(String clinicGUID) +47
patient_edu.BindProviders() +118
patient_edu.Page_Load(Object sender, EventArgs e) +30
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061

Here is what the WSDL file looks like:

<?xml version="1.0" encoding="ISO-8859-1"?>
<definitions 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:tns="http://http://www.example.com/services/EorthoContent" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://www.example.com/services/EorthoContent">
<types><xsd:schema targetNamespace="http://www.example.com/services/EorthoContent"
>
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
<xsd:complexType name="ArrayOf_xsd_string">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="xsd:string[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="ArrayOfArrayOf_xsd_string">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:ArrayOf_xsd_string[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>
</types>

...and then the function stuff starts.

Can anyone help me figure out why ASP.NET can't recognize the complex type ArrayOf_xsd_string?

Any help would be much appreciated.

Thanks,
Matt

[edited by: dreamcatcher at 7:03 pm (utc) on Aug. 21, 2007]
[edit reason] Use example.com, thanks. [/edit]

 

eelixduppy




msg:3429533
 1:40 am on Aug 23, 2007 (gmt 0)

Moving post - hopefully some asp.net guru can help :) (bump)

Easy_Coder




msg:3430342
 4:57 pm on Aug 23, 2007 (gmt 0)

There are limitation with the xml serialization, I know I ran into something similar a few years ago when trying to return a Datareader, I believe I ended up moving to a DataSet.

leahco




msg:3431278
 3:39 pm on Aug 24, 2007 (gmt 0)

So here's another interesting point to the issue. If I switch to using the built-in SOAP extension in PHP5 and modify the WSDL file slightly, the ASP.NET sites and sites written in PHP5 have no problems, but anything written in PHP4 using nusoap.php or PEAR::SOAP doesn't receive the data correctly.

Here's an example of what the data should look like when I do a var_dump() on the returned data:

array(6) {
[0]=>
array(3) {
[0]=>
string(32) "775ab1f814d5190fb55685dbe1c6f7bd"
[1]=>
string(11) "Kyphoplasty"
[2]=>
string(115) "http://www.example.com/Booklet?ClinicID=6beb792d81342ab4b7b7bed7d91a7d79&TopicID=775ab1f814d5190fb55685dbe1c6f7bd"
}
[1]=>
array(3) {
[0]=>
string(32) "4cdc554cbf052d95d0c6218dca340a98"
[1]=>
string(21) "Scheuermann's Disease"
[2]=>
string(115) "http://www.example.com/Booklet?ClinicID=6beb792d81342ab4b7b7bed7d91a7d79&TopicID=4cdc554cbf052d95d0c6218dca340a98"
}
[2]=>
array(3) {
[0]=>
string(32) "012d86ee608acac7457ac979ae7d550d"
[1]=>
string(28) "Spinal Compression Fractures"
[2]=>
string(115) "http://www.example.com/Booklet?ClinicID=6beb792d81342ab4b7b7bed7d91a7d79&TopicID=012d86ee608acac7457ac979ae7d550d"
}
[3]=>
array(3) {
[0]=>
string(32) "e2017d1a959a7159fc3514414c705aa3"
[1]=>
string(24) "Thoracic Disc Herniation"
[2]=>
string(115) "http://www.example.com/Booklet?ClinicID=6beb792d81342ab4b7b7bed7d91a7d79&TopicID=e2017d1a959a7159fc3514414c705aa3"
}
[4]=>
array(3) {
[0]=>
string(32) "4c75b421ca09b5cb875c90e13c68d969"
[1]=>
string(22) "Thoracic Spine Anatomy"
[2]=>
string(115) "http://www.example.com/Booklet?ClinicID=6beb792d81342ab4b7b7bed7d91a7d79&TopicID=4c75b421ca09b5cb875c90e13c68d969"
}
[5]=>
array(3) {
[0]=>
string(32) "cd057911c3a4cd05b8a79cd5d8e3a05a"
[1]=>
string(14) "Vertebroplasty"
[2]=>
string(115) "http://www.example.com/Booklet?ClinicID=6beb792d81342ab4b7b7bed7d91a7d79&TopicID=cd057911c3a4cd05b8a79cd5d8e3a05a"
}
}

But here's what I am getting:

array(1) {
["item"]=>
array(8) {
[0]=>
string(32) "775ab1f814d5190fb55685dbe1c6f7bd"
[1]=>
string(11) "Kyphoplasty"
[2]=>
string(115) "http://www.example.com/Booklet?ClinicID=6beb792d81342ab4b7b7bed7d91a7d79&TopicID=775ab1f814d5190fb55685dbe1c6f7bd"
[3]=>
array(3) {
[0]=>
string(32) "4cdc554cbf052d95d0c6218dca340a98"
[1]=>
string(21) "Scheuermann's Disease"
[2]=>
string(115) "http://www.example.com/Booklet?ClinicID=6beb792d81342ab4b7b7bed7d91a7d79&TopicID=4cdc554cbf052d95d0c6218dca340a98"
}
[4]=>
array(3) {
[0]=>
string(32) "012d86ee608acac7457ac979ae7d550d"
[1]=>
string(28) "Spinal Compression Fractures"
[2]=>
string(115) "http://www.example.com/Booklet?ClinicID=6beb792d81342ab4b7b7bed7d91a7d79&TopicID=012d86ee608acac7457ac979ae7d550d"
}
[5]=>
array(3) {
[0]=>
string(32) "e2017d1a959a7159fc3514414c705aa3"
[1]=>
string(24) "Thoracic Disc Herniation"
[2]=>
string(115) "http://www.example.com/Booklet?ClinicID=6beb792d81342ab4b7b7bed7d91a7d79&TopicID=e2017d1a959a7159fc3514414c705aa3"
}
[6]=>
array(3) {
[0]=>
string(32) "4c75b421ca09b5cb875c90e13c68d969"
[1]=>
string(22) "Thoracic Spine Anatomy"
[2]=>
string(115) "http://www.example.com/Booklet?ClinicID=6beb792d81342ab4b7b7bed7d91a7d79&TopicID=4c75b421ca09b5cb875c90e13c68d969"
}
[7]=>
array(3) {
[0]=>
string(32) "cd057911c3a4cd05b8a79cd5d8e3a05a"
[1]=>
string(14) "Vertebroplasty"
[2]=>
string(115) "http://www.example.com/Booklet?ClinicID=6beb792d81342ab4b7b7bed7d91a7d79&TopicID=cd057911c3a4cd05b8a79cd5d8e3a05a"
}
}
}

This is what the WSDL file looks like now:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://www.example.com/services/EorthoContent" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://www.example.com/services/EorthoContent" xmlns:intf="http://www.example.com/services/EorthoContent" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<schema targetNamespace="http://www.example.com/services/EorthoContent" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="ArrayOfArrayOf_xsd_string">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[][]"/>
</restriction>
</complexContent>
</complexType>
<complexType name="ArrayOf_xsd_string">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/>
</restriction>
</complexContent>
</complexType>
</schema>
</wsdl:types>

I am just returning an array with a structure like so"
$ret[0][0] = "some string here";
$ret[0][1] = "some string here";
$ret[1][0] = "some string here";
$ret[1][1] = "some string here";
...

return $ret;

I have tried creating a SoapVar like this:
$ret_final = new SoapVar($ret, SOAP_ENC_OBJECT, "ArrayOfArray_xsd_string", "http://www.example.com/services/EorthoContent");

return $ret_final;

But I still get the same incorrect data structure.

Suggestions?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved