my dog learned polymorphism*
The moose likes Web Services and the fly likes JAX-WS - several newbie questions. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "JAX-WS - several newbie questions." Watch "JAX-WS - several newbie questions." New topic
Author

JAX-WS - several newbie questions.

Jeremy Botha
Ranch Hand

Joined: Feb 16, 2005
Posts: 125
Disclaimer - I have very little experience (or understanding) of how the entire webservice - SOAP world works; what little understanding I have is pretty painful. Be gentle.

I'm attempting to access a ASP/IIS webservice published by a third party. It's a content billing service. The only call I make to this interface is purchase(...) - parameters are txn reference ids, content charges etc. Immaterial, anyway.

Part of the specification for this service requires a SOAP header block, containing four fields in an <authentication> element. It looks like this:
<authentication xmlns="http://remote.host">
<Interface_Login>username</Interface_Login>
<Interface_Password>password<Interface_Password>
<ClientLogin>username</ClientLogin>
<ClientPassword>password</ClientPassword>
</authentication>

I've tried building this service with JAX-RPX 1.1 and Axis 1.2; neither allowed me to manipulate and send a SOAP header block using classes generated with wscompile and the axis client class generators respectively.

I downloaded and installed JAX-WS 2.0, and generated the classes. I can now create and populate the correct header blocks.

Several things concern me. Firstly, the JAX-WS soap messages appear as such:

<?xml version="1.0" ?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Header>HEADER INFORMATION</S:Header>
<S:Body>BODY</S:Body></S:Envelope>

I do not get any remote exceptions; I am however worried that the remote machine might be expecting elements with the <soap:Header> and <soap:Body> rather than S:Header and S:Body - anyone know if it is possible to change this?

Second: How do I specify the XML encoding for the soap message? It should be UTF-8. I can't find any methods that will allow me to set the message encoding.

Thirdly, the authentication block generated by JAX-WS looks like this:

<authentication xmlns="http://remote.host/"><Interface_Login xmlns="">un</Interface_Login><Interface_Password xmlns="">pw/Interface_Password><ClientLogin xmlns="">un</ClientLogin><ClientPassword xmlns="">pw</ClientPassword></authentication>

Even though I create the four subelements with no explicit namespace. I know this shouldn't be a problem for a decent remote XML parser, but I'm not sure of the quality of the parser used by the remote site I'm connecting to.

Lastly (this is just a whine) - the JAX-WS annotations make me want to slit my wrists. At least I could trace through the JAX-RPC stub classes. Ugh.

thanks, and sorry if this is covered somewhere else.
Jeremy
[ June 28, 2007: Message edited by: Jeremy Botha ]

McFinnigan? Never heard of him. Nobody here but us chickens...<br /> <br />SCJP for Java 1.4<br />SCJD for Java 5.0
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JAX-WS - several newbie questions.
 
Similar Threads
JAX-WS with Jdk1.6. problem with body content going in header while consuming
web service security
random xmlns attribute order causing unexpected XML tag exception
unexpected XML tag in JAX-WS client
Web Services/SOAP Newbie question