You need to sign in to do that
Don't have an account?
jwolf
Setting soap header
I'm trying to connect to a soap web service which implicitly defines a required soap header. That part of the WSDL looks like this:
<s0:Policy s1:Id="Auth.xml">
<wssp:Identity xmlns:wssp="http://www.bea.com/wls90/security/policy">
<wssp:SupportedTokens>
<wssp:SecurityToken TokenType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken">
<wssp:UsePassword Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"/>
</wssp:SecurityToken>
</wssp:SupportedTokens>
</wssp:Identity>
</s0:Policy>
<wsp:UsingPolicy s2:Required="true"/>
In order to call this service, I need to set my soap header to look like this:
<soapenv:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-3" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>someusername</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">somepassword</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
So, wsdl2apex doesn't create these elements when generating the apex class. As far as I can see its not possible to set arbitrary soap headers from within apex. At this point I've tried to modify the WSDL to make this explicit and I've tried to modify the generated class to produce the proper header but I've had no luck up to this point. Anyone have any ideas? Is this possible from within apex?
AFAIK, its is possible to set the headers. WSDL2Apex must have created the inner classes for header. Or something must be wrong with the WSDL.
I have a similar issue. DId you ever figure out how this was done?
As a workaround, I ended up manually making the soap request.
how do you manually create a SOAP request?