2 Replies Latest reply on Nov 4, 2005 4:07 AM by thomas.diesler

    Client from Amazon Webservices

    bogsolomon

      I am using Jboss 4.0.2(tried 4.0.3 also) with the JbossWS package. I am trying to create a client that would connect to the Amazon webservice. For that I have obtained the wsdl, used wscompile to generate the classes and the mapping. I have then created a web.xml, jboss-web.xml, a small jsp page and a class that creates the service and the port and then sends arequest. Everything deploys but when I get the answer I get the following error

      org.xml.sax.SAXException: Invalid element in amazon.ws.ItemSearchResponse - OperationRequest
       at org.jboss.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.java:432)
       at org.jboss.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:1168)
       at org.jboss.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:244)
       at org.jboss.axis.message.SOAPElementAxisImpl.publishToHandler(SOAPElementAxisImpl.java:1389)
       at org.jboss.axis.message.RPCElement.deserialize(RPCElement.java:262)
       at org.jboss.axis.message.RPCElement.getParams(RPCElement.java:396)
       at org.jboss.axis.client.Call.invoke(Call.java:2672)
       at org.jboss.axis.client.Call.invoke(Call.java:2548)
       at org.jboss.axis.client.Call.invokeInternal(Call.java:1979)
       at org.jboss.axis.client.Call.invoke(Call.java:1917)
       at org.jboss.webservice.client.CallImpl.invoke(CallImpl.java:265)
       at org.jboss.axis.client.AxisClientProxy.invokeSEIMethod(AxisClientProxy.java:286)
       at org.jboss.webservice.client.PortProxy.invoke(PortProxy.java:177)
       at $Proxy54.itemSearch(Unknown Source)
      


      my jaxrpc-mapping-client.xml contains the OperationRequest in ItemSearchResponse
      <java-type>amazon.ws.ItemSearchResponse</java-type>
      <anonymous-type-qname>http://webservices.amazon.com/AWSECommerceService/2005-10-05:&gt;ItemSearchResponse</anonymous-type-qname>
      <qname-scope>complexType</qname-scope>
      <variable-mapping>
      <java-variable-name>operationRequest</java-variable-name>
      <xml-element-name>OperationRequest</xml-element-name>
      </variable-mapping>
      <variable-mapping>
      <java-variable-name>items</java-variable-name>
      <xml-element-name>Items</xml-element-name>
      </variable-mapping>
      </java-xml-type-mapping>
      

      and
      <java-type>amazon.ws.OperationRequest</java-type>
      <anonymous-type-qname>http://webservices.amazon.com/AWSECommerceService/2005-10-05:&gt;&gt;HelpResponse&gt;OperationRequest</anonymous-type-qname>
      <qname-scope>complexType</qname-scope>
      <variable-mapping>
      <java-variable-name>HTTPHeaders</java-variable-name>
      <xml-element-name>HTTPHeaders</xml-element-name>
      </variable-mapping>
      <variable-mapping>
      <java-variable-name>requestId</java-variable-name>
      <xml-element-name>RequestId</xml-element-name>
      </variable-mapping>
      <variable-mapping>
      <java-variable-name>arguments</java-variable-name>
      <xml-element-name>Arguments</xml-element-name>
      </variable-mapping>
      <variable-mapping>
      <java-variable-name>errors</java-variable-name>
      <xml-element-name>Errors</xml-element-name>
      </variable-mapping>
      <variable-mapping>
      <java-variable-name>requestProcessingTime</java-variable-name>
      <xml-element-name>RequestProcessingTime</xml-element-name>
      </variable-mapping>
      </java-xml-type-mapping>
      


      From what I have read on the forums the problem might be with the way they are declared in the WSDL as annonymous. However I am not sure how to fix this.

        • 1. Re: Client from Amazon Webservices
          bogsolomon

          Managed to solve that problem by mapping each of the properties in a ws4ee-deployment file. I can contact the web service but it is not receiving my parameters. I have found this http://www.jboss.org/index.html?module=bb&op=viewtopic&t=60455 as a solution to the problem. However it is not updating the SOAP message with the appropriate namespaces.

           <typeMapping
           qname='ns2:ItemSearch' xmlns:ns2='http://webservices.amazon.com/AWSECommerceService/2005-10-05'
           type='java:webservices.amazon.com.ItemSearch'
           serializer='org.jboss.webservice.encoding.ser.MetaDataBeanSerializerFactory'
           deserializer='org.jboss.webservice.encoding.ser.MetaDataBeanDeserializerFactory'
           encodingStyle=''>
           <typeDesc>
           <elementDesc fieldName='SubscriptionId' xmlName='ns2:SubscriptionId'/>
           <elementDesc fieldName='Request' xmlName='ns2:Request'/>
           </typeDesc>
           </typeMapping>
          


          still results in
          <soapenv:Body>
           <ns1:ItemSearch xmlns:ns1="http://webservices.amazon.com/AWSECommerceService/2005-10-05">
           <subscriptionId>xxxxxxxx</subscriptionId>
           <AWSAccessKeyId>xxxxxxxxx</AWSAccessKeyId>
           <associateTag/>
           <XMLEscaping>Single</XMLEscaping>
           <validate>false</validate>
           <shared xsi:nil="1"/>
           <request>
           <actor xsi:nil="1"/>
          


          • 2. Re: Client from Amazon Webservices
            thomas.diesler

            Support elementFormDefault=qualified should be fixed

            http://jira.jboss.com/jira/browse/JBWS-474