1 Reply Latest reply on Apr 13, 2005 8:14 AM by thomas.diesler

    Error while trying to consume Amazon Webservice

    chris1

      G'day!
      I'm using Jboss 5 (Date 05/03/18) from CVS and trying to consume the amazon webservice defined at http://webservices.amazon.com/AWSECommerceService/2005-03-23/DE/AWSECommerceService.wsdl without any success. I'm always getting the following exception:


      Caused by: org.xml.sax.SAXException: Invalid element in com.amazon.webservices.AWSECommerceService.HelpResponse - OperationRequest
      at org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.java:407)


      Following the documentation at http://www.jboss.org/wiki/Wiki.jsp?page=JBossWS
      I've generated my java classes and jaxrpc-mapping.xml-file with patched jwsdp-1.5-jaxrcp-tools:

      wscompile -gen:client -f:documentliteral -mapping jaxrpc-mapping.xml d:\workspace/wsdl_client_gen/jwsdp_jaxrcp_config.xml


      I was able to deploy all files as EJB2.1-Session-Bean but when calling the endpoint from within my sessionbean I'll get the error from above. By the way: everything works as expected when consuming Google-Webservice, so I cannot be so wrong.

      server.log gives the following interesting information:

      ...
      2005-03-26 15:35:36,203 DEBUG [org.jboss.webservice.client.ServiceImpl] Service configuration:
      ...
      <#!-- Serializer/Deserializer not found, ignore type mapping
      <#typeMapping
      qname='ns1:>>>>>>>ItemSearchResponse>Items>Item>Offers>Offer>Seller>SellerFeedback>Feedback[1,unbounded]'
      xmlns:ns1='http://webservices.amazon.com/AWSECommerceService/2005-03-23'
      type='java:com.amazon.webservices.AWSECommerceService.Feedback[]'
      serializer='null'
      deserializer='null'
      encodingStyle=''>
      <#/typeMapping>
      -->
      ...

      Every complex-type-array is commented out as above. Maybe this is the reason for following error.

      Log goes on:

      2005-03-26 15:35:36,468 DEBUG [org.apache.axis.transport.http.HTTPSender] <#?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>
      <#ns1:Help xmlns:ns1="http://webservices.amazon.com/AWSECommerceService/2005-03-23">
      <#SubscriptionId>xxx<#/SubscriptionId>
      <#AssociateTag>xxx<#/AssociateTag>
      <#Validate>false<#/Validate>
      <#Shared>
      <#About>ItemLookup<#/About>
      <#HelpType>Operation<#/HelpType>
      <#ResponseGroup xsi:nil="1"/>
      <#/Shared>
      <#Request xsi:nil="1"/>
      <#/ns1:Help>
      <#/soapenv:Body>
      <#/soapenv:Envelope>

      2005-03-26 15:35:36,468 DEBUG [org.apache.axis.transport.http.HTTPSender] ----------------------------------------------
      2005-03-26 15:35:36,781 DEBUG [org.apache.axis.transport.http.HTTPSender] HTTP/1.1 200 OK
      2005-03-26 15:35:36,781 DEBUG [org.apache.axis.transport.http.HTTPSender] ----------------------------------------------
      2005-03-26 15:35:36,781 DEBUG [org.apache.axis.transport.http.HTTPSender] <#?xml version="1.0" encoding="UTF-8"?><#SOAP-
      ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"><#SOAP-ENV:Body><#HelpResponse
      xmlns="http://webservices.amazon.com/AWSECommerceService/2005-03-23">
      <#OperationRequest>
      <#HTTPHeaders>
      <#Header Name="UserAgent" Value="Axis/#axisVersion#">
      <#/Header>
      <#/HTTPHeaders>
      <#RequestId>08FNHG1DBNYYBB0M4XNM<#/RequestId>
      <#Arguments>
      <#Argument Name="Service" Value="AWSECommerceService"><#/Argument>
      <#/Arguments>
      <#RequestProcessingTime>0.033113956451416<#/RequestProcessingTime>
      <#/OperationRequest>
      <#Information>
      <#Request>
      <#IsValid>True<#/IsValid>
      <#/Request>
      <#OperationInformation>
      <#Name>ItemLookup<#/Name><#RequiredParameters><#Parameter>ItemId<#/Parameter><#Parameter>SubscriptionId<#/Parameter><#/RequiredParameters>
      <#AvailableParameters><#Parameter>AssociateTag<#/Parameter><#Parameter>Condition<#/Parameter>
      <#Parameter>ContentType<#/Parameter><#Parameter>DeliveryMethod<#/Parameter><#Parameter>ISPUPostalCode<#/Parameter>
      <#Parameter>IdType<#/Parameter><#Parameter>Marketplace<#/Parameter><#Parameter>MerchantId<#/Parameter>
      <#Parameter>OfferPage<#/Parameter><#Parameter>ReviewPage<#/Parameter><#Parameter>SearchIndex<#/Parameter>
      <#Parameter>Style<#/Parameter><#Parameter>Validate<#/Parameter><#Parameter>VariationPage<#/Parameter>
      <#Parameter>Version<#/Parameter><#Parameter>XMLEscaping<#/Parameter><#/AvailableParameters>
      <#DefaultResponseGroups><#ResponseGroup>Request<#/ResponseGroup><#ResponseGroup>Small<#/ResponseGroup>
      ...<#/OperationInformation><#/Information><#/HelpResponse><#/SOAP-ENV:Body><#/SOAP-ENV:Envelope>
      2005-03-26 15:35:36,781 DEBUG [org.apache.axis.transport.http.HTTPSender] ----------------------------------------------

      ...

      2005-03-26 15:35:36,812 DEBUG [org.apache.axis.encoding.DeserializationContextImpl] Exit: DeserializationContextImpl::endDocument()
      2005-03-26 15:35:36,812 DEBUG [org.apache.axis.MessagePart] Setting current message form to: FORM_SOAPENVELOPE
      2005-03-26 15:35:36,812 DEBUG [org.apache.axis.MessagePart] Exit: SOAPPart::getAsSOAPEnvelope
      2005-03-26 15:35:36,812 DEBUG [org.apache.axis.client.Call] Exit: Call::invoke()
      2005-03-26 15:35:36,812 DEBUG [org.apache.axis.MessagePart] Enter: SOAPPart::getAsSOAPEnvelope()
      2005-03-26 15:35:36,812 DEBUG [org.apache.axis.MessagePart] current form is FORM_SOAPENVELOPE
      2005-03-26 15:35:36,812 DEBUG [org.apache.axis.encoding.DeserializationContextImpl] Pushing handler org.apache.axis.message.RPCHandler@4a547f
      2005-03-26 15:35:36,812 DEBUG [org.apache.axis.encoding.DeserializationContextImpl] Enter: DeserializationContextImpl::startPrefixMapping(, http://webservices.amazon.com/AWSECommerceService/2005-03-23)
      2005-03-26 15:35:36,812 DEBUG [org.apache.axis.encoding.DeserializationContextImpl] Exit: DeserializationContextImpl::startPrefixMapping()
      2005-03-26 15:35:36,812 DEBUG [org.apache.axis.encoding.DeserializationContextImpl] Enter: DeserializationContextImpl::startElement(http://webservices.amazon.com/AWSECommerceService/2005-03-23, HelpResponse)
      2005-03-26 15:35:36,812 DEBUG [org.apache.axis.message.RPCHandler] Enter: RPCHandler.onStartChild()
      2005-03-26 15:35:36,812 DEBUG [org.apache.axis.message.RPCHandler] Type from attributes is: null
      2005-03-26 15:35:36,812 DEBUG [org.apache.axis.encoding.DeserializationContextImpl] Enter:getDeserializer: [class=class com.amazon.webservices.AWSECommerceService.HelpResponse,xmlType={http://webservices.amazon.com/AWSECommerceService/2005-03-23}HelpResponse]
      2005-03-26 15:35:36,812 DEBUG [org.apache.axis.encoding.DeserializationContextImpl] Exit:getDeserializer: org.jboss.webservice.encoding.ser.MetaDataBeanDeserializer@1f1769d
      2005-03-26 15:35:36,812 DEBUG [org.apache.axis.message.RPCHandler] Exit: RPCHandler.onStartChild()
      2005-03-26 15:35:36,812 DEBUG [org.apache.axis.encoding.DeserializationContextImpl] Pushing handler org.jboss.webservice.encoding.ser.MetaDataBeanDeserializer@1f1769d
      2005-03-26 15:35:36,812 DEBUG [org.apache.axis.encoding.DeserializationContextImpl] Exit: DeserializationContextImpl::startElement()
      2005-03-26 15:35:36,812 DEBUG [org.apache.axis.encoding.DeserializationContextImpl] Enter: DeserializationContextImpl::startElement(http://webservices.amazon.com/AWSECommerceService/2005-03-23, OperationRequest)
      2005-03-26 15:35:36,812 DEBUG [org.apache.axis.encoding.ser.BeanDeserializer] onStartChild: {http://webservices.amazon.com/AWSECommerceService/2005-03-23}OperationRequest
      2005-03-26 15:35:36,812 ERROR [org.apache.axis.client.Call] Exception:
      org.xml.sax.SAXException: Invalid element in com.amazon.webservices.AWSECommerceService.HelpResponse - OperationRequest
      at org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.java:407)
      at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:1166)
      at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:244)
      at org.apache.axis.message.SOAPElementAxisImpl.publishToHandler(SOAPElementAxisImpl.java:1387)
      at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:262)
      at org.apache.axis.message.RPCElement.getParams(RPCElement.java:396)
      at org.apache.axis.client.Call.invoke(Call.java:2641)
      at org.apache.axis.client.Call.invoke(Call.java:2513)
      at org.apache.axis.client.Call.invokeInternal(Call.java:1973)



      I don't know anything more to try.

      Please tell me if you need more information.

      Chris





        • 1. Re: Error while trying to consume Amazon Webservice
          thomas.diesler

          Have a look at the generated WSDD in ${jboss.server.data.dir}/wsdl. It will probably contain a number of commented out type mappings, which were derived from the jaxrpc-mapping.xml and other sources.

          At deployment time the type mapping could not be validated, so it was commented out.

          Also, the jaxrpc-mapping.xml seems to use ananomous names complex types in schema. That is, when the schema defines an element and gives its complex type definition as a child element rather than referencing it by name.

          The generated type-mappings in WSDD can be overridden in the ws4ee-deployment.xml descriptor, which you proabably have to use in your case.