users@jax-rpc.java.net

Re: unexpected element type: QName vs. string

From: Doug Kohlert <doug.kohlert_at_sun.com>
Date: Tue, 11 Mar 2003 11:03:48 -0800

Robert,
I used your config file and client and ran your test. Here is the response
message:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:amazon="http://soap.amazon.com">
      <SOAP-ENV:Body>
          <SOAP-ENV:Fault>
              <faultcode xsi:type="xsd:string">SOAP-ENV:Server</faultcode>
              <faultstring xsi:type="xsd:string">Server Error</faultstring>
              <detail xsi:type="xsd:string"> We encountered an error processing this request. Please try again
</detail>
          </SOAP-ENV:Fault>
      </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

 From this message you can see that the faultcode is of type "xsd:string", however
according to the SOAP 1.1 spec it should be an xsd:QName, thus the error.

Robert Lowe wrote:
> As a learning exercise, I'm trying to invoke the Amazon.com Web services
> using JAX-RPC. I have the Web Service Developers Kit version 1.1, with
> JAX-RPC 1.0.3.
>
> I have run the wscompile command against the WSDL descriptor, using the
> attached config.xml file, with a command line of the form:
>
> wscompile -d classes -gen -keep -s src -verbose config.xml
>
> This works fine; I generate javadocs from the generated source files, and
> package the classes in a JAR file. I then try to invoke the service using
> the attached Java client (AmazonClient.java). I get the exception shown
> below. It looks as though some element or attribute name can't be converted
> to a QName, but I cannot tell why.
>
> Obviously it would be easier to debug this if I could intercept the actual
> SOAP message. I'm wondering what would be the easiest way to do this--would
> I need to write a handler?
>
> Thanks in advance for any help.
>
> ========================================
>
> java.rmi.RemoteException: Runtime exception; nested exception is:
> unexpected element type: expected={http://www.w3.org/2001/XMLSchema}QName,
> actual={http://www.w3.org/2001/XMLSchema}string
>
> unexpected element type: expected={http://www.w3.org/2001/XMLSchema}QName,
> actual={http://www.w3.org/2001/XMLSchema}string
>
> at
> com.sun.xml.rpc.encoding.SerializerBase.verifyType(SerializerBase.java:129)
>
> at
> com.sun.xml.rpc.encoding.SimpleTypeSerializer.deserialize(SimpleTypeSerializ
> er.java:101)
>
> at
> com.sun.xml.rpc.encoding.SOAPFaultInfoSerializer.doDeserialize(SOAPFaultInfo
> Serializer.java:63)
>
> at
> com.sun.xml.rpc.encoding.ObjectSerializerBase.deserialize(ObjectSerializerBa
> se.java:165)
>
> at
> com.sun.xml.rpc.client.StreamingSender._readBodyFaultElement(StreamingSender
> .java:348)
>
> at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:165)
>
> at
> com.netdimen.amazon.AmazonSearchPort_Stub.keywordSearchRequest(AmazonSearchP
> ort_Stub.java:623)
>
> at amazon.AmazonClient.doKeywordSearch(AmazonClient.java:49)
>
> at amazon.AmazonClient.main(AmazonClient.java:61)
>
>
>
> Robert Lowe
> http://RMLowe.com/
>
> +852 9520 4722
> rmlowe_at_rmlowe.com
>
>
> ------------------------------------------------------------------------
>
> <?xml version="1.0" encoding="UTF-8"?>
> <configuration
> xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">
> <wsdl location="http://soap.amazon.com/schemas2/AmazonWebServices.wsdl"
> packageName="com.netdimen.amazon"/>
> </configuration>


-- 
Doug Kohlert
Java Software Division
Sun Microsystems, Inc.
phone: 503 345-9806