[jboss-user] [JBossWS] - Re: Specifying the server's URL in the client?

EricJava do-not-reply at jboss.com
Wed Feb 13 18:23:07 EST 2008


Hello Oskar,

Thanks for the suggestion.  I tried that.  After doing it that way, I had the problem of needing to use JAXB to put my parameters into the SOAPBody.  That worked, but then I got unsolvable class conflicts where I got to this:

     [java] Exception in thread "main" com.sun.xml.ws.streaming.XMLStreamReaderException: XML reader error: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
  |      [java] Message: Premature end of file.
  |      [java]     at com.sun.xml.ws.streaming.XMLStreamReaderUtil.wrapException(XMLStreamReaderUtil.java:256)
  |      [java]     at com.sun.xml.ws.streaming.XMLStreamReaderUtil.next(XMLStreamReaderUtil.java:84)
  | ....
  |      [java] Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
  |      [java] Message: Premature end of file.
  |      [java]     at com.sun.xml.stream.XMLReaderImpl.next(XMLReaderImpl.java:563)
  |      [java]     at com.sun.xml.ws.util.xml.XMLStreamReaderFilter.next(XMLStreamReaderFilter.java:92)
  | 

What's strange is that the message went through just fine.  The server read it and parsed it with no errors.  But the client gave me that error.  I had been hoping that SOAP would do all the marshaling / unmarshaling for me, without me needing to invoke JAXB stuff, but apparently it doesn't, and there doesn't seem to be a way of solving that XML parsing exception.  This is all in Java 6.

Then I looked back at http://jbws.dyndns.org/mediawiki/index.php?title=JBossWS_JAX-WS_Tools and there is some suggestion to do this:

/* Set NEW Endpoint Location */
  |       String endpointURL = "http://NEW_ENDPOINT_URL";
  |       BindingProvider bp = (BindingProvider)echo;
  |       bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointURL);

And that works!  I use wsclient.sh.  No problems.  I'm sure I can take the wsclient.sh and turn that into a script to execute my client.

I think that was added to that info about endpointURL page within the past couple of days because I didn't see it there last week.

Anyway... so I'm now happily able to use the JBossWS libraries on the client side, and specify a URL at run-time, without having to re-fetch the WSDL with every single request.  So that's good.

The next thorny question: What if I want to add some attachments to my messages?  In particular I want to send some image files, etc, with the SOAP message.  Is there a way to do that?

I could go back to generating the SOAPMessage as above, but then I'll run into the same class loader hell that I couldn't solve before.  Unless someone has solved that, I need to figure out some other way.

The alternative to all this is to write my own SOAP library, which might be less effort than figuring out how to resolve the class file conflicts in JBossWS + Java 6.  But if someone knows how to solve some of these things, then that will be easiest.

Thanks for any suggestions.


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4129271#4129271

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4129271



More information about the jboss-user mailing list