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
> >
>

Reply via email to