• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JAX-WS MessageCreationException

 
peter wong ka chon
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have create a simple web service which return a response but i getting a MessageCreationException due to unexpected EOF for .

I got four methods inside this webservice only method with return response has this problem.

com.sun.xmlns.soap.MessageCreationException: Couldn't create SOAP message due to exception: XML reader error: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF; was expecting a close tag for element

cause by com.sun.xml.ws.streaming.XMLStreamReaderException: XML reader error: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF; was expecting a close tag for element

cause by com.ctc.wstx.exc.WstxEOFException: Unexpected EOF; was expecting a close tag for element

Any idea how to solve this. What is the root cause of this problem? I guess the create soap message failed due to did not add the end tag. Why is this happen?

I don't know how to debug further from here.

Please help.

Thanks.
 
Sumit Patil
Ranch Hand
Posts: 296
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Although i do not know about webservices, but it seems one of the tag in one of your XML file is not closed properly....
 
Palak Mathur
Ranch Hand
Posts: 328
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check if the soap message that you are creating is correctly formed. If you can paste the code and SOAP message then we can help.
 
peter wong ka chon
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Palak Mathur wrote:Check if the soap message that you are creating is correctly formed. If you can paste the code and SOAP message then we can help.


@WebMethod(operationName="searchCreditCard")
@WebResult(name="creditCard")
public Creditcard searchCreditCard(@WebParam(name="creditCard_id")String id);

The exception is throw when create the response message.

I don't know how to get the SOAP message. I using netbeans IDE and SOAPUI 4.0.0. From the endpoint, i create a mock service then i insert data into the request and click the play but it show some GlassFish 3.1.2 server running html page rather than soap message. What wrong with this? Is it wrong URL? I don't know the URL. OK, I know the URL already it is http://peterwkcComp:808/CreditCardService/CreditcardService fromt netbeans deployment log msg.

The soap message is following:
<?xml version="1.0" encoding="UTF-8">
<S:Envelope xmlns:S="">
<S:Body>




By the way, what is document and literal for SOAP binding?

Please help.

Thanks.
 
Palak Mathur
Ranch Hand
Posts: 328
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
peter wong ka chon wrote:
Palak Mathur wrote:Check if the soap message that you are creating is correctly formed. If you can paste the code and SOAP message then we can help.


@WebMethod(operationName="searchCreditCard")
@WebResult(name="creditCard")
public Creditcard searchCreditCard(@WebParam(name="creditCard_id")String id);

The exception is throw when create the response message.

I don't know how to get the SOAP message. I using netbeans IDE and SOAPUI 4.0.0.

By the way, what is document and literal for SOAP binding?

Please help.

Thanks.


How are you creating the response message?

Document/literal is a style of WSDL SOAP Binding. A WSDL SOAP Binding can be of two types:-
1. Remote Procedure Call (RPC) style binding or
2. Document style binding

And also they can have encoded or literal use. Thus there are four style-use combination models:
1. RPC/encoded
2. RPC/literal
3. Document/encoded
4. Document/literal

Mostly we use document/literal or to say another model (not exactly a model), called, document/literal wrapped. But these styles have nothing to do with programming and only means how to translate WSDL to a SOAP message. Thats all.

For a detailed information on WSDL SOAP Bindings, refer:- http://www.ibm.com/developerworks/webservices/library/ws-whichwsdl/
 
peter wong ka chon
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem has been solved somehow but i get the xml.bind.MarshallException com.sun.istack,SAXException2: A cycle is detected in the object graph. This will cause infinitely deep xml: CreditCard -> Customer -> CreditCard.

How to solve this? I solve it using @XMLTransient. How to implement the afterMarshall() technique.

Thanks.
 
Palak Mathur
Ranch Hand
Posts: 328
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
peter wong ka chon wrote:The problem has been solved somehow but i get the xml.bind.MarshallException com.sun.istack,SAXException2: A cycle is detected in the object graph. This will cause infinitely deep xml: CreditCard -> Customer -> CreditCard.

How to solve this? I solve it using @XMLTransient. How to implement the afterMarshall() technique.

Thanks.


Please post your code.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic