Hi Anne, After you mentioned that Axis gives a wrapped array no matter what, I tried changing the encoding the document/literal. With document/literal the WSDL is generated properly :
<?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions targetNamespace="http://integration" xmlns:impl="http://integration" xmlns:intf="http://integration" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> <!--WSDL created by Apache Axis version: 1.2RC3 Built on Feb 28, 2005 (10:15:14 EST)--> <wsdl:types> <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://integration" elementFormDefault="qualified"> <element name="in0" type="xsd:string" /> <complexType name="ArrayOf_xsd_string"> <sequence> <element name="item" type="xsd:string" minOccurs="0" maxOccurs="unbounded" /> </sequence> </complexType> <element name="getArrayOfStringReturn" type="impl:ArrayOf_xsd_string" /> </schema> </wsdl:types> <wsdl:message name="getArrayOfStringResponse"> <wsdl:part name="getArrayOfStringReturn" element="impl:getArrayOfStringReturn" /> </wsdl:message> <wsdl:message name="getArrayOfStringRequest"> <wsdl:part name="in0" element="impl:in0" /> </wsdl:message> <wsdl:portType name="SapumoPort"> <wsdl:operation name="getArrayOfString" parameterOrder="in0"> <wsdl:input name="getArrayOfStringRequest" message="impl:getArrayOfStringRequest" /> <wsdl:output name="getArrayOfStringResponse" message="impl:getArrayOfStringResponse" /> </wsdl:operation> </wsdl:portType> <wsdl:binding name="sapSoapBinding" type="impl:SapumoPort"> <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="getArrayOfString"> <wsdlsoap:operation soapAction="" /> <wsdl:input name="getArrayOfStringRequest"> <wsdlsoap:body use="literal" /> </wsdl:input> <wsdl:output name="getArrayOfStringResponse"> <wsdlsoap:body use="literal" /> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="SapumoService"> <wsdl:port name="sap" binding="impl:sapSoapBinding"> <wsdlsoap:address location="http://localhost:801/services/sap" /> </wsdl:port> </wsdl:service> </wsdl:definitions> with the exception of <element name="getArrayOfStringReturn" maxOccurs="unbounded" type="impl:ArrayOf_xsd_string" /> where I had to take out maxOccurs="unbounded" attribute as .net complained about it. I think this must be another bug in java2wsdl as maxOccurs="unbound" should only be present in the wrapped array type. Anyways now Axis gives the following SOAP message : - <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <soapenv:Body> - <getArrayOfStringReturn xmlns="http://integration"> <item xsi:type="xsd:string" xmlns="">Harsha</item> <item xsi:type="xsd:string" xmlns="">Prabath</item> <item xsi:type="xsd:string" xmlns="">Senanayake</item> </getArrayOfStringReturn> </soapenv:Body> </soapenv:Envelope> which seems to conform to the WSDL. I am not sure if xmlns="" must be causing an issue, but even when i forced that in still .net client gives an NPE. [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare)] [return: System.Xml.Serialization.XmlArrayAttribute("getArrayOfStringReturn", Namespace="http://integration")] [return: System.Xml.Serialization.XmlArrayItemAttribute("item", Namespace="http://integration", IsNullable=false)] public string[] getArrayOfString([System.Xml.Serialization.XmlElementAttribute(Namespace="http://integration")] string in0) { object[] results = this.Invoke("getArrayOfString", new object[] { in0}); return ((string[])(results[0])); } Is there anything I can do to fix this? or is there any other opensource SOAP engine I can use? thanks, Harsha. On Apr 9, 2005 11:46 PM, Anne Thomas Manes <[EMAIL PROTECTED]> wrote: > Axis is generating a wrapped array (using the <item> element), but > your WSDL specifies an unwrapped array (no item element). I can't > remeber what that status of the fix for this is. > > Anne > > On Apr 9, 2005 9:36 AM, harsha senanayake <[EMAIL PROTECTED]> wrote: > > Hello Anne, > > > > I am sorry for raising a question without thoroughly going through the > > wiki & the mailing list. I am new to the webservices business, and I > > realized the main reason for that error was using the default rpc > > encoding -- and after i changed it to wrapped/literal .net client > > stopped throwing the exception. I know this should have been the first > > thing i should have tried, but i was not aware of different styles of > > encoding SOAP messages. But even after I switched to wrapped/literal I > > had this issue where .net client just returning the 1st element of the > > array. Dino suggests to use the write WSDL first approach, but this is > > not possible as I am using Mule (muleumo.org) for exposing components > > via SOAP and other mediums. I applied the Eric's patch but the problem > > didnt go away. > > > > http://localhost:801/services/sap?wsdl > > > > <?xml version="1.0" encoding="UTF-8" ?> > > - <wsdl:definitions targetNamespace="http://integration" > > xmlns:impl="http://integration" xmlns:intf="http://integration" > > xmlns:apachesoap="http://xml.apache.org/xml-soap" > > xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" > > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > > xmlns:tns1="http://DefaultNamespace" > > xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> > > - <!-- > > WSDL created by Apache Axis version: 1.2RC3 > > Built on Apr 09, 2005 (05:39:00 LKT) > > > > --> > > - <wsdl:types> > > - <schema xmlns="http://www.w3.org/2001/XMLSchema" > > targetNamespace="http://DefaultNamespace" > > elementFormDefault="qualified"> > > - <element name="getArrayOfString"> > > - <complexType> > > - <sequence> > > <element name="in0" type="xsd:string" /> > > </sequence> > > </complexType> > > </element> > > - <element name="getArrayOfStringResponse"> > > - <complexType> > > - <sequence> > > <element name="getArrayOfStringReturn" type="xsd:string" > > maxOccurs="unbounded" /> > > </sequence> > > </complexType> > > </element> > > </schema> > > </wsdl:types> > > - <wsdl:message name="getArrayOfStringResponse"> > > <wsdl:part name="parameters" element="tns1:getArrayOfStringResponse" /> > > </wsdl:message> > > - <wsdl:message name="getArrayOfStringRequest"> > > <wsdl:part name="parameters" element="tns1:getArrayOfString" /> > > </wsdl:message> > > - <wsdl:portType name="SapumoPort"> > > - <wsdl:operation name="getArrayOfString"> > > <wsdl:input name="getArrayOfStringRequest" > > message="impl:getArrayOfStringRequest" /> > > <wsdl:output name="getArrayOfStringResponse" > > message="impl:getArrayOfStringResponse" /> > > </wsdl:operation> > > </wsdl:portType> > > - <wsdl:binding name="sapSoapBinding" type="impl:SapumoPort"> > > <wsdlsoap:binding style="document" > > transport="http://schemas.xmlsoap.org/soap/http" /> > > - <wsdl:operation name="getArrayOfString"> > > <wsdlsoap:operation soapAction="" /> > > - <wsdl:input name="getArrayOfStringRequest"> > > <wsdlsoap:body use="literal" /> > > </wsdl:input> > > - <wsdl:output name="getArrayOfStringResponse"> > > <wsdlsoap:body use="literal" /> > > </wsdl:output> > > </wsdl:operation> > > </wsdl:binding> > > - <wsdl:service name="SapumoService"> > > - <wsdl:port name="sap" binding="impl:sapSoapBinding"> > > <wsdlsoap:address location="http://localhost:801/services/sap" /> > > </wsdl:port> > > </wsdl:service> > > </wsdl:definitions> > > > > SOAP response : > > > > <?xml version="1.0" encoding="UTF-8" ?> > > - <soapenv:Envelope > > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" > > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> > > - <soapenv:Body> > > - <getArrayOfStringResponse xmlns=""> > > - <ns1:getArrayOfStringReturn xmlns:ns1="http://integration"> > > <item xsi:type="xsd:string">Harsha</item> > > <item xsi:type="xsd:string">Prabath</item> > > <item xsi:type="xsd:string">Senanayake</item> > > </ns1:getArrayOfStringReturn> > > </getArrayOfStringResponse> > > </soapenv:Body> > > </soapenv:Envelope> > > > > This is a code extract from the C# proxy class : > > > > [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", > > RequestNamespace="http://DefaultNamespace", > > ResponseNamespace="http://DefaultNamespace", > > Use=System.Web.Services.Description.SoapBindingUse.Literal, > > ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] > > [return: > > System.Xml.Serialization.XmlElementAttribute("getArrayOfStringReturn")] > > public string[] getArrayOfString(string in0) { > > object[] results = this.Invoke("getArrayOfString", new object[] > > { > > in0}); > > return ((string[])(results[0])); > > } > > > > and yes I tried changing the above to > > System.Xml.Serialization.XmlArrayItemAttribute("getArrayOfString")] > > which resulted in a NPE. I also noticed that after applying Eric's > > patch the only change in the SOAP message was - > > <ns1:getArrayOfStringReturn xmlns:ns1="http://integration"> tag. > > > > I also went through Dino's excellent writeup - > > http://wiki.apache.org/ws/FrontPage/Axis/DotNetInterop but i am > > confused how he got the array samples to work, may be because he used > > the write WSDL first approach. What am i still doing wrong? I will > > really appreciate any suggestions to overcome this issue. > > > > thanks, > > Harsha. > > > > > > On Apr 9, 2005 2:23 AM, Anne Thomas Manes <[EMAIL PROTECTED]> wrote: > > > Please see Dino's extremely informative wiki on Axis/.NET array interop: > > > http://wiki.apache.org/ws/DotNetInteropArrays > > > > > > You also may need to install Eric's famous patch. See: > > > > > > http://marc.theaimsgroup.com/?l=axis-user&m=109587880222477&w=2 > > > http://marc.theaimsgroup.com/?l=axis-user&m=109631383200039&w=2 > > > http://marc.theaimsgroup.com/?l=axis-user&m=109646648222389&w=2 > > > > > > On Apr 7, 2005 1:13 PM, harsha senanayake <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > > > > > I have been struggling to invoke a webservice method which returns any > > > > type of array from .Net. Whenever I call a method for eg. > > > > string[] list() found in http://127.0.0.1:8080/axis/EchoHeaders.jws > > > > i get an error saying Unhandled Exception: > > > > System.InvalidOperationException: There is an error in > > > > XML document (1, 308). ---> System.InvalidOperationException: The > > > > specified type was not recognized: name='string', > > > > namespace='http://schemas.xmlsoap.org/soap/encoding/', at > > > > <whoamiReturn xmlns=''>. > > > > > > > > What am I doing wrong here? is there a work around for this problem? > > > > really appreciate if someone could help me out. > > > > > > > > thanks. > > > > Harsha > > > > > > > > > >
