You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by angeloimm <an...@libero.it> on 2005/04/13 14:26:04 UTC

Error in simple application

Hi all; i'm working by using Axis1.2 RC3, JBuilder 2005, JSDK1.4.2_07, windows xp Home Edition.
I have this simple web service:

package it.eng.test;

import org.w3c.dom.Document;


public class Server {

    public Document echo(Document doc) {
        return doc;
    }
}

I have this WSDL (generated by JBuilder):
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://test.eng.it" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://test.eng.it" xmlns:intf="http://test.eng.it" 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 created by Apache Axis version: 1.2beta3
Built on Aug 01, 2004 (05:59:22 PDT)-->

   <wsdl:message name="echoRequest">

      <wsdl:part name="doc" type="apachesoap:Document"/>

   </wsdl:message>

   <wsdl:message name="echoResponse">

      <wsdl:part name="echoReturn" type="apachesoap:Document"/>

   </wsdl:message>

   <wsdl:portType name="Server">

      <wsdl:operation name="echo" parameterOrder="doc">

         <wsdl:input message="impl:echoRequest" name="echoRequest"/>

         <wsdl:output message="impl:echoResponse" name="echoResponse"/>

      </wsdl:operation>

   </wsdl:portType>

   <wsdl:binding name="ServerSoapBinding" type="impl:Server">

      <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

      <wsdl:operation name="echo">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="echoRequest">

            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded"/>

         </wsdl:input>

         <wsdl:output name="echoResponse">

            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded"/>

         </wsdl:output>

      </wsdl:operation>

   </wsdl:binding>

   <wsdl:service name="ServerService">

      <wsdl:port binding="impl:ServerSoapBinding" name="Server">

         <wsdlsoap:address location="http://localhost:8080/server/services/Server"/>

      </wsdl:port>

   </wsdl:service>

</wsdl:definitions>

And i have this client:

package it.eng.test;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;

import org.w3c.dom.Document;
import javax.xml.namespace.QName;


import java.net.URL;

import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;

public class SimpleClient {
    public static void main(String[] args) {

        try {
            DocumentBuilderFactory fac = DocumentBuilderFactory.newInstance();
            fac.setValidating(false);
            DocumentBuilder builder = fac.newDocumentBuilder();
            String p = "<?xml version='1.0' encoding='UTF-8'?>"+
                       "<nome>Ciao</nome>";
            Document doc = builder.parse(new java.io.ByteArrayInputStream(p.
                    getBytes()));

            Call call = (Call) (new Service()).createCall();
            call.setTargetEndpointAddress(new URL(
                    "http://localhost:8082/server/services/Server"));
            call.setOperation(new QName("http://localhost:8082/server/services/Server", "echo"),"echo");

              System.out.println( call.invoke(new Object[] {doc}).getClass().getName() );

        } catch (Exception ex) {

            ex.printStackTrace();
        }

    }
}

Now in the TCPMonitor i have this messages:

Request:

POST /server/services/Server HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.2RC2
Host: 127.0.0.1:8082
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: ""
Content-Length: 298
<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>
      <echo xmlns="">
         <arg0 xsi:type="xsd:anyType">
            <nome>Ciao</nome>
         </arg0>
      </echo>
   </soapenv:Body>
</soapenv:Envelope>

Why is there the tag arg0 ?
In response to this request i have:

HTTP/1.1 200 OK
X-Powered-By: Servlet 2.4; Tomcat-5.0.28/JBoss-3.2.6 (build: CVSTag=JBoss_3_2_6 date=200410140106)
Content-Type: text/xml;charset=utf-8
Date: Wed, 13 Apr 2005 12:20:43 GMT
Server: Apache-Coyote/1.1
Connection: close
<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>
      <echo xmlns="">
         <arg0 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:anyType" xmlns="">
            <nome xmlns="">Ciao</nome>
         </arg0>
      </echo>
   </soapenv:Body>
</soapenv:Envelope>

How we can see there is the document i have sent; the method do nothing other than re-send te document to the client.
Well i have this exception on the client:

- Exception:
org.xml.sax.SAXException: Deserializing parameter 'arg0':  could not find deserializer for type {http://www.w3.org/2001/XMLSchema}anyType
	at org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:273)
	at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1031)
	at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
	at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1140)
	at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:347)
	at org.apache.axis.message.RPCElement.getParams(RPCElement.java:386)
	at org.apache.axis.client.Call.invoke(Call.java:2402)
	at org.apache.axis.client.Call.invoke(Call.java:2301)
	at org.apache.axis.client.Call.invoke(Call.java:1758)
	at it.eng.test.SimpleClient.main(SimpleClient.java:32)
AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode: 
 faultString: org.xml.sax.SAXException: Deserializing parameter 'arg0':  could not find deserializer for type {http://www.w3.org/2001/XMLSchema}anyType
 faultActor: 
 faultNode: 
 faultDetail: 
	{http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException: Deserializing parameter 'arg0':  could not find deserializer for type {http://www.w3.org/2001/XMLSchema}anyType
	at org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:273)
	at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1031)
	at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
	at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1140)
	at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:347)
	at org.apache.axis.message.RPCElement.getParams(RPCElement.java:386)
	at org.apache.axis.client.Call.invoke(Call.java:2402)
	at org.apache.axis.client.Call.invoke(Call.java:2301)
	at org.apache.axis.client.Call.invoke(Call.java:1758)
	at it.eng.test.SimpleClient.main(SimpleClient.java:32)

	{http://xml.apache.org/axis/}hostname:PORT-IMMEDIATA

org.xml.sax.SAXException: Deserializing parameter 'arg0':  could not find deserializer for type {http://www.w3.org/2001/XMLSchema}anyType
	at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
	at org.apache.axis.client.Call.invoke(Call.java:2405)
	at org.apache.axis.client.Call.invoke(Call.java:2301)
	at org.apache.axis.client.Call.invoke(Call.java:1758)
	at it.eng.test.SimpleClient.main(SimpleClient.java:32)
Caused by: org.xml.sax.SAXException: Deserializing parameter 'arg0':  could not find deserializer for type {http://www.w3.org/2001/XMLSchema}anyType
	at org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:273)
	at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1031)
	at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
	at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1140)
	at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:347)
	at org.apache.axis.message.RPCElement.getParams(RPCElement.java:386)
	at org.apache.axis.client.Call.invoke(Call.java:2402)
	... 3 more
Can anybody why?
I'm not able to understand the arg0 tag... why is it there?
Thanks to all.



____________________________________________________________
Navighi a 4 MEGA e i primi 3 mesi sono GRATIS. 
Scegli Libero Adsl Flat senza limiti su http://www.libero.it



Re: Error in simple application

Posted by Anne Thomas Manes <at...@gmail.com>.
You get the extra tag because you're using document/encoded, which is
an invalid combination of style and use. You should be using
document/literal. You've also specified a "type" attribute in your
message part, but you should specify an element type.

Try this WSDL:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://test.eng.it"
xmlns:impl="http://test.eng.it"
xmlns:intf="http://test.eng.it" 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.2beta3
Built on Aug 01, 2004 (05:59:22 PDT)-->

  <wsdl:message name="echoRequest">
     <wsdl:part name="doc" element="xsd:any>"/>
  </wsdl:message>

  <wsdl:message name="echoResponse">
     <wsdl:part name="echoReturn" element="xsd:any"/>
  </wsdl:message>

  <wsdl:portType name="Server">
     <wsdl:operation name="echo" parameterOrder="doc">
        <wsdl:input message="impl:echoRequest" name="echoRequest"/>
        <wsdl:output message="impl:echoResponse" name="echoResponse"/>
     </wsdl:operation>
  </wsdl:portType>

  <wsdl:binding name="ServerSoapBinding" type="impl:Server">
     <wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
     <wsdl:operation name="echo">
        <wsdlsoap:operation soapAction=""/>
        <wsdl:input name="echoRequest">
           <wsdlsoap:body use="literal"/>
        </wsdl:input>
        <wsdl:output name="echoResponse">
           <wsdlsoap:body use="literal"/>
        </wsdl:output>
     </wsdl:operation>
  </wsdl:binding>

  <wsdl:service name="ServerService">
     <wsdl:port binding="impl:ServerSoapBinding" name="Server">
        <wsdlsoap:address
location="http://localhost:8080/server/services/Server"/>
     </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

On 4/13/05, angeloimm <an...@libero.it> wrote:
> Hi all; i'm working by using Axis1.2 RC3, JBuilder 2005, JSDK1.4.2_07, windows xp Home Edition.
> I have this simple web service:
> 
> package it.eng.test;
> 
> import org.w3c.dom.Document;
> 
> public class Server {
> 
>     public Document echo(Document doc) {
>         return doc;
>     }
> }
> 
> I have this WSDL (generated by JBuilder):
> <?xml version="1.0" encoding="UTF-8"?>
> <wsdl:definitions targetNamespace="http://test.eng.it" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://test.eng.it" xmlns:intf="http://test.eng.it" 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 created by Apache Axis version: 1.2beta3
> Built on Aug 01, 2004 (05:59:22 PDT)-->
> 
>    <wsdl:message name="echoRequest">
> 
>       <wsdl:part name="doc" type="apachesoap:Document"/>
> 
>    </wsdl:message>
> 
>    <wsdl:message name="echoResponse">
> 
>       <wsdl:part name="echoReturn" type="apachesoap:Document"/>
> 
>    </wsdl:message>
> 
>    <wsdl:portType name="Server">
> 
>       <wsdl:operation name="echo" parameterOrder="doc">
> 
>          <wsdl:input message="impl:echoRequest" name="echoRequest"/>
> 
>          <wsdl:output message="impl:echoResponse" name="echoResponse"/>
> 
>       </wsdl:operation>
> 
>    </wsdl:portType>
> 
>    <wsdl:binding name="ServerSoapBinding" type="impl:Server">
> 
>       <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
> 
>       <wsdl:operation name="echo">
> 
>          <wsdlsoap:operation soapAction=""/>
> 
>          <wsdl:input name="echoRequest">
> 
>             <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded"/>
> 
>          </wsdl:input>
> 
>          <wsdl:output name="echoResponse">
> 
>             <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded"/>
> 
>          </wsdl:output>
> 
>       </wsdl:operation>
> 
>    </wsdl:binding>
> 
>    <wsdl:service name="ServerService">
> 
>       <wsdl:port binding="impl:ServerSoapBinding" name="Server">
> 
>          <wsdlsoap:address location="http://localhost:8080/server/services/Server"/>
> 
>       </wsdl:port>
> 
>    </wsdl:service>
> 
> </wsdl:definitions>
> 
> And i have this client:
> 
> package it.eng.test;
> 
> import org.apache.axis.client.Call;
> import org.apache.axis.client.Service;
> 
> import org.w3c.dom.Document;
> import javax.xml.namespace.QName;
> 
> import java.net.URL;
> 
> import javax.xml.parsers.DocumentBuilderFactory;
> import javax.xml.parsers.DocumentBuilder;
> 
> public class SimpleClient {
>     public static void main(String[] args) {
> 
>         try {
>             DocumentBuilderFactory fac = DocumentBuilderFactory.newInstance();
>             fac.setValidating(false);
>             DocumentBuilder builder = fac.newDocumentBuilder();
>             String p = "<?xml version='1.0' encoding='UTF-8'?>"+
>                        "<nome>Ciao</nome>";
>             Document doc = builder.parse(new java.io.ByteArrayInputStream(p.
>                     getBytes()));
> 
>             Call call = (Call) (new Service()).createCall();
>             call.setTargetEndpointAddress(new URL(
>                     "http://localhost:8082/server/services/Server"));
>             call.setOperation(new QName("http://localhost:8082/server/services/Server", "echo"),"echo");
> 
>               System.out.println( call.invoke(new Object[] {doc}).getClass().getName() );
> 
>         } catch (Exception ex) {
> 
>             ex.printStackTrace();
>         }
> 
>     }
> }
> 
> Now in the TCPMonitor i have this messages:
> 
> Request:
> 
> POST /server/services/Server HTTP/1.0
> Content-Type: text/xml; charset=utf-8
> Accept: application/soap+xml, application/dime, multipart/related, text/*
> User-Agent: Axis/1.2RC2
> Host: 127.0.0.1:8082
> Cache-Control: no-cache
> Pragma: no-cache
> SOAPAction: ""
> Content-Length: 298
> <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>
>       <echo xmlns="">
>          <arg0 xsi:type="xsd:anyType">
>             <nome>Ciao</nome>
>          </arg0>
>       </echo>
>    </soapenv:Body>
> </soapenv:Envelope>
> 
> Why is there the tag arg0 ?
> In response to this request i have:
> 
> HTTP/1.1 200 OK
> X-Powered-By: Servlet 2.4; Tomcat-5.0.28/JBoss-3.2.6 (build: CVSTag=JBoss_3_2_6 date=200410140106)
> Content-Type: text/xml;charset=utf-8
> Date: Wed, 13 Apr 2005 12:20:43 GMT
> Server: Apache-Coyote/1.1
> Connection: close
> <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>
>       <echo xmlns="">
>          <arg0 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:anyType" xmlns="">
>             <nome xmlns="">Ciao</nome>
>          </arg0>
>       </echo>
>    </soapenv:Body>
> </soapenv:Envelope>
> 
> How we can see there is the document i have sent; the method do nothing other than re-send te document to the client.
> Well i have this exception on the client:
> 
> - Exception:
> org.xml.sax.SAXException: Deserializing parameter 'arg0':  could not find deserializer for type {http://www.w3.org/2001/XMLSchema}anyType
>         at org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:273)
>         at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1031)
>         at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
>         at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1140)
>         at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:347)
>         at org.apache.axis.message.RPCElement.getParams(RPCElement.java:386)
>         at org.apache.axis.client.Call.invoke(Call.java:2402)
>         at org.apache.axis.client.Call.invoke(Call.java:2301)
>         at org.apache.axis.client.Call.invoke(Call.java:1758)
>         at it.eng.test.SimpleClient.main(SimpleClient.java:32)
> AxisFault
>  faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
>  faultSubcode:
>  faultString: org.xml.sax.SAXException: Deserializing parameter 'arg0':  could not find deserializer for type {http://www.w3.org/2001/XMLSchema}anyType
>  faultActor:
>  faultNode:
>  faultDetail:
>         {http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException: Deserializing parameter 'arg0':  could not find deserializer for type {http://www.w3.org/2001/XMLSchema}anyType
>         at org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:273)
>         at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1031)
>         at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
>         at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1140)
>         at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:347)
>         at org.apache.axis.message.RPCElement.getParams(RPCElement.java:386)
>         at org.apache.axis.client.Call.invoke(Call.java:2402)
>         at org.apache.axis.client.Call.invoke(Call.java:2301)
>         at org.apache.axis.client.Call.invoke(Call.java:1758)
>         at it.eng.test.SimpleClient.main(SimpleClient.java:32)
> 
>         {http://xml.apache.org/axis/}hostname:PORT-IMMEDIATA
> 
> org.xml.sax.SAXException: Deserializing parameter 'arg0':  could not find deserializer for type {http://www.w3.org/2001/XMLSchema}anyType
>         at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
>         at org.apache.axis.client.Call.invoke(Call.java:2405)
>         at org.apache.axis.client.Call.invoke(Call.java:2301)
>         at org.apache.axis.client.Call.invoke(Call.java:1758)
>         at it.eng.test.SimpleClient.main(SimpleClient.java:32)
> Caused by: org.xml.sax.SAXException: Deserializing parameter 'arg0':  could not find deserializer for type {http://www.w3.org/2001/XMLSchema}anyType
>         at org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:273)
>         at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1031)
>         at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
>         at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1140)
>         at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:347)
>         at org.apache.axis.message.RPCElement.getParams(RPCElement.java:386)
>         at org.apache.axis.client.Call.invoke(Call.java:2402)
>         ... 3 more
> Can anybody why?
> I'm not able to understand the arg0 tag... why is it there?
> Thanks to all.
> 
> ____________________________________________________________
> Navighi a 4 MEGA e i primi 3 mesi sono GRATIS.
> Scegli Libero Adsl Flat senza limiti su http://www.libero.it
> 
>