PDA

View Full Version : Soap Response Error



cicpa
Jul 27th, 2006, 11:04 AM
I follow the example present in the spring-ws-1.0-m1 distribution (airline).
The server works fine (i use jaxb for mar/unm).
I have some problem with my Client The Soap Response return with envelope=null;
I used TCPMON for debug end in the response message there is the right xml.

I think the xml soap response need the namespace end the prefix for all the elements to work (but is only my opinion).

this is the wsdl
http://www.dynaweb.it/etone/schemas/etone.wsdl

this is the xsd
http://www.dynaweb.it/etone/schemas/etone.xsd

the client
http://www.dynaweb.it/etone/schemas/ProductDetailAction.java



THE HTTP REQUEST

POST /ETONE/Product HTTP/1.1
Content-Type: text/xml; charset="utf-8"
Content-Length: 415
SOAPAction: ""
Cache-Control: no-cache
Pragma: no-cache
User-Agent: Java/1.5.0_01
Host: 127.0.0.1
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<etone:GetBrandsXSubCategoryRequest xmlns:etone="http://www.dynaweb.it/etone/schemas">
<etone:user>user</etone:user>
<etone:password>pwd</etone:password>
<etone:companyId>1</etone:companyId>
<etone:subCategoryId>1</etone:subCategoryId>
</etone:GetBrandsXSubCategoryRequest>
</SOAP-ENV:Body></SOAP-ENV:Envelope>



THE HTTP RESPONSE

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
X-Powered-By: Servlet 2.4; JBoss-4.0.2 (build: CVSTag=JBoss_4_0_2 date=200505022023)/Tomcat-5.5
Content-Type: text/xml;charset=UTF-8
Content-Length: 555
Date: Thu, 27 Jul 2006 15:46:13 GMT

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<GetBrandsXSubCategoryResponse xmlns="http://www.dynaweb.it/etone/schemas">
<brands>
<brandId>1</brandId>
<brand>Sony</brand>
</brands>
<brands>
<brandId>2</brandId>
<brand>HP</brand>
</brands>
<brands>
<brandId>3</brandId>
<brand>Bozzarelli</brand>
</brands>
<brands>
<brandId>4</brandId>
<brand>MeteoPio.it</brand>
</brands>
<brands>
<brandId>5</brandId>
<brand>cheStappAfa.it</brand>
</brands>
</GetBrandsXSubCategoryResponse>
</SOAP-ENV:Body></SOAP-ENV:Envelope>


Please help me!

Thanks

Arjen Poutsma
Jul 27th, 2006, 02:50 PM
Are you sure the envelope is null? You can write the message with SOAPMessage.writeTo(System.out) or something similar.

cicpa
Jul 28th, 2006, 05:13 AM
This is the soapResponse.writeTo(System.out);

[STDOUT] <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body><GetBrandsXSubCategoryResponse xmlns="http://www.dynaweb.it/etone/schemas"><brands><brandId>1</brandId><brand>Sony</brand></brands><brands><brandId>2</brandId><brand>HP</brand></brands><brands><brandId>3</brandId><brand>Bozzarelli</brand></brands><brands><brandId>4</brandId><brand>MeteoPio.it</brand></brands><brands><brandId>5</brandId><brand>cheStappAfa.it</brand></brands></GetBrandsXSubCategoryResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>




when i try soapResponse.getSOAPBody(); this is the result

12:03:07,859 INFO [STDOUT] 28-lug-2006 12.03.07 com.sun.xml.messaging.saaj.soap.EnvelopeFactory createEnvelope
GRAVE: SAAJ0511: Unable to create envelope from given source
12:03:14,781 WARN [RequestProcessor] Unhandled Exception thrown: class com.sun.xml.messaging.saaj.SOAPExceptionImpl
12:03:14,812 ERROR [[action]] Servlet.service() for servlet action threw exception
com.sun.xml.messaging.saaj.SOAPExceptionImpl: Unable to create envelope from given source:
at com.sun.xml.messaging.saaj.soap.EnvelopeFactory.cr eateEnvelope(EnvelopeFactory.java:71)
at com.sun.xml.messaging.saaj.soap.ver1_1.SOAPPart1_1 Impl.createEnvelopeFromSource(SOAPPart1_1Impl.java :34)
at com.sun.xml.messaging.saaj.soap.SOAPPartImpl.getEn velope(SOAPPartImpl.java:82)
at com.sun.xml.messaging.saaj.soap.MessageImpl.getSOA PBody(MessageImpl.java:598)
at org.dynaweb.estore.catalog.test.action.ProductDeta ilAction.execute(ProductDetailAction.java:86)

.........

Caused by: javax.xml.transform.TransformerException: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
at org.apache.xalan.transformer.TransformerIdentityIm pl.transform(TransformerIdentityImpl.java:449)
at com.sun.xml.messaging.saaj.soap.EnvelopeFactory.cr eateEnvelope(EnvelopeFactory.java:63)
... 42 more
Caused by: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
at org.apache.xml.utils.DOMBuilder.startElement(DOMBu ilder.java:322)
at org.apache.xalan.transformer.TransformerIdentityIm pl.startElement(TransformerIdentityImpl.java:1020)
at org.xml.sax.helpers.XMLFilterImpl.startElement(Unk nown Source)


CAUSE:

javax.xml.transform.TransformerException: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
at org.apache.xalan.transformer.TransformerIdentityIm pl.transform(TransformerIdentityImpl.java:449)
at com.sun.xml.messaging.saaj.soap.EnvelopeFactory.cr eateEnvelope(EnvelopeFactory.java:63)
at com.sun.xml.messaging.saaj.soap.ver1_1.SOAPPart1_1 Impl.createEnvelopeFromSource(SOAPPart1_1Impl.java :34)



Thanks for your time
Bye

Arjen Poutsma
Jul 28th, 2006, 08:05 AM
Seems to be a SAAJ problem. You are using the reference implementation by SUN, but which version of SAAJ are you using?

cicpa
Jul 28th, 2006, 08:37 AM
I use saaj 1.2, the same jar file of the airline example (saaj-api.jar).

thanks

Arjen Poutsma
Jul 28th, 2006, 04:10 PM
Well, since it is really a SAAJ only problem, you might try googling somewhat (http://www.google.com/search?q=SAAJ0511) .

This particular issue seems related: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4967753, and the guy solved it by replacing xalan.

cicpa
Aug 2nd, 2006, 04:07 AM
I 've solved, the problem was the xerces implemetation of my jboss 4.0.2 present in the endorsed dir. i've deleted the jars end now jboss use the java 1.5 xerces impl end everything work fine.

Thanks a lot for your help.

Bye