aspose file tools*
The moose likes Web Services and the fly likes JAX-WS MessageCreationException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "JAX-WS MessageCreationException" Watch "JAX-WS MessageCreationException" New topic
Author

JAX-WS MessageCreationException

peter wong ka chon
Ranch Hand

Joined: Jul 28, 2011
Posts: 39
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

Joined: May 25, 2009
Posts: 296

Although i do not know about webservices, but it seems one of the tag in one of your XML file is not closed properly....

Thanks & Regards, Sumeet
SCJP 1.4, SCWCD 5, LinkedIn Profile
Palak Mathur
Ranch Hand

Joined: Jan 29, 2007
Posts: 313

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.


Palak Mathur | My Blog | TechJaunt | What is JavaRanch? | List of All FAQs
peter wong ka chon
Ranch Hand

Joined: Jul 28, 2011
Posts: 39
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

Joined: Jan 29, 2007
Posts: 313

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

Joined: Jul 28, 2011
Posts: 39
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

Joined: Jan 29, 2007
Posts: 313

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JAX-WS MessageCreationException