Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.
  <soapenv:Header>
  <wsse:Security SOAP-ENV:mustUnderstand="1" xmlns:SOAP-ENV="SOAP-ENV">
     <wsse:UsernameToken wsu:Id="UsernameToken-1" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <wsse:Username>oneview</wsse:Username>
        <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">oneview123</wsse:Password>
     </wsse:UsernameToken>
  </wsse:Security>

Here is how my header is structured in request .By default when my stub is generated from WSDL no information regarding header in WSDL .So is there any code in apex i can start and include in my stub class and create this kind of header.

Update:

<wsp:Policy wsu:Id="UsernameToken" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
    <wsp:ExactlyOne>
        <wsp:All>
            <sp:SupportingTokens xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702">
                <wsp:Policy>
                    <sp:UsernameToken sp:IncludeToken=".../IncludeToken/AlwaysToRecipient"/>
                </wsp:Policy>
            </sp:SupportingTokens>
        </wsp:All>
    </wsp:ExactlyOne>
</wsp:Policy>

The WSDL has wsp and policy .Do WSDL to apex support this.Any help appreciated

share|improve this question
    
Do you have the WSDL your trying to use? In some cases you can modify the generated code afterwards to add the missing bits the WSDL to Apex tool did not output. –  Andrew Fawcett Jan 24 '13 at 14:01
    
    
@AndrewFawcett The above link is my wsdl.I could not modify anyting and get this working :( –  Mohith Kumar Jan 24 '13 at 16:07
add comment

1 Answer

up vote 2 down vote accepted

The standard WSDL-->Apex feature does not support including any WSS or WSP headers in the outgoing SOAP request. You will need to forgo the WSDL-->Apex generated classes and instead manually construct the request SOAP message and then invoke the web service using the Apex HTTP callout classes. This thread should be helpful in showing you how to do this - http://boards.developerforce.com/t5/Apex-Code-Development/SOAP-Webservice-Callout-Issue-Generating-Output-Headers-Response/m-p/171411/highlight/true#M26424. Hope this helps.

Sandeep

share|improve this answer
    
excellent!Thanks for the reply!Awesome and thanks again! –  Mohith Kumar Jan 24 '13 at 5:47
    
SoapUI is an excellent tool for generating the XML you need to send. –  LaceySnr Jan 24 '13 at 5:50
    
Do you know if there exists any wrapper or other workaround instead generating the XML to send and analysing the response parsing the result? –  Martin Borthiry Nov 29 '13 at 11:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.