facebook

Problem with a web service

  1. MyEclipse Archived
  2.  > 
  3. Web Services
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #296629 Reply

    javaariel
    Member

    Hi everybody:

    I have a problem with a web service I am doing, I have made a web service that returns a collection of objects, the objects have a set of properties, there is one property that is a String, consist in a text fragment that could have some characters that are considered special in XML like &, <, >, ” and that’s why when I execute the service from a client an exception is thrown:

    
    Exception in thread "main" org.codehaus.xfire.XFireRuntimeException: Could not invoke service.. Nested exception is org.codehaus.xfire.fault.XFireFault: Could not read XML stream.. Nested exception is com.ctc.wstx.exc.WstxParsingException: Expected a text token, got START_ELEMENT.
     at [row,col {unknown-source}]: [9,646]
    org.codehaus.xfire.fault.XFireFault: Could not read XML stream.. Nested exception is com.ctc.wstx.exc.WstxParsingException: Expected a text token, got START_ELEMENT.
     at [row,col {unknown-source}]: [9,646]
        at org.codehaus.xfire.fault.XFireFault.createFault(XFireFault.java:89)
        at org.codehaus.xfire.client.Client.onReceive(Client.java:410)
        at org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:139)
        at org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)
        at org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
        at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
        at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:79)
        at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:114)
        at org.codehaus.xfire.client.Client.invoke(Client.java:336)
        at org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
        at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
        at $Proxy0.search(Unknown Source)
        at cu.co.cenatav.webservices.client.Client.main(Client.java:26)
    

    I know that this is happening because special characters are sent by the soap message but I don’t know how to solve this problem.
    How could I avoid this exception ?
    I hope you can help me.
    Regards.
    Ariel

    #296639 Reply

    Loyal Water
    Member

    Ariel,
    This seems like an XFire issue and I would suggest you cross post this query on the XFire forums as well.

    #296640 Reply

    javaariel
    Member

    I have generated this web services with MyEclipse 6.0, are there bugs in the XFire libraries ???

    Why could I solve this problem ??? Should I use another library instead of XFire ???

    Regards
    Ariel

    #296641 Reply

    Ton Huisman
    Member

    XML Special characters should be xml-ified, with & for &, < for <, > for >, and " for “. This is explained in detail on this w3c page

    HTH
    Ton

    #296729 Reply

    Loyal Water
    Member

    Thanks for the information.

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: Problem with a web service

You must be logged in to post in the forum log in