0

It's looking amazingly difficult to use any of the most used soap services framework (at least those I've tried) and come up with this kind of soap request

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://bencws.foobar.com/doc/2008-01-01/" 
    xmlns:soap="http://www.w3.org/2003/05/soap-envelope/">
    <soap:Header xmlns:foo="http://safe.foobar.com/doc/2007-01-01/" xmlns:oof="http://www.w3.org/2005/08/addressing">
        <foo:AccessKeyId>0PKRFZMV7GRJ11N791R2</foo:AccessKeyId>
        <foo:Timestamp>2008-03-07T23:55:22.693Z</foo:Timestamp>
        <foo:Signature>someencodedstring</foo:Signature>
        <oof:Action>SomeAction</oof:Action>
        <oof:To>http://bencws.foobar.com</oof:To>
        <oof:MessageID>120493412293</oof:MessageID>
        <oof:ReplyTo>
            <oof:Address> http://www.w3.org/2005/08/addressing/anonymous</oof:Address>
        </oof:ReplyTo>
    </soap:Header>
    <soap:Body>
    ...

With cxf I started using cxf-codegen-plugin to create classes stub from wsdl file. But then the "standard" thingie did not allow to change soap:Header namespace or even add stuff inside the tag (unless you bend over backwards twice)

With axis2 I used WSDL2Java and endend up with the same kind of troubles.

I've come up with what would look like formally "correct" soap requests but freaking foobar service won't accept them anyways unless my soap:Envelope and soap:Header don't look exactly like that.

Any help will be much appreciated. Should I try something else? We're now at the point we're thinking to write the xml requests manually which is something I'd avoid.

mfirry
  • 3,634
  • 1
  • 26
  • 36
  • Which version SOAP use _foobar_ service? 1.1 or 1.2? – CAMOBAP Oct 23 '12 at 09:32
  • Yeah, I also had trouble with cxf and soap Headers. It is possible, but feels like its buried so weirdly, you're not supposed to find it. Still, I would prefer cxf over axis2..maybe thats something personal though. But why would you want to change the soap namespace? I mean.. do you want to use soap or not? – Scorpio Oct 23 '12 at 09:35
  • seriously at this point i don't even know! they just told me it has to be like that. – mfirry Oct 23 '12 at 09:51
  • With respect, if you have been able to produce a message that has elements with the right local names and namespace URIs but the service won't accept them unless you use specific prefixes, etc. then I'm afraid it's the _service_ that is broken, not the client... – Ian Roberts Oct 23 '12 at 16:16
  • @Ian Roberts i agree. what can i say... let's just say foobar is one of the top tech corporation rigth now :) – mfirry Oct 24 '12 at 16:05

1 Answers1

0

With CXF, getting the namespaces declared onto the soap:Envelope is relatively easy. You can provide a Map of namespace -> prefix to the client via a request property:

((BindingProvider)proxy).getRequestContext().put("soap.env.ns.map", map);

Thus, if you can have the foo and oof namespaces declared there, you could do that. Adding them onto the soap:Header is definitely not an easy thing to do. :-(

Daniel Kulp
  • 14,447
  • 4
  • 45
  • 37