KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I generated client java objects using JAX-WS RI. I am trying to make a SOAP request to a web service. Service requires authentication in the header which looks like below: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header> <xsd:authHeader> <xsd:user>username@gmail.com</xsd:user> <xsd:password>password1</xsd:password> </xsd:authHeader> </soapenv:Header> <soapenv:Body> <ns:searchAssetsParam> <ns:includeSubfolders>true</ns:includeSubfolders> <ns:resultsPage>2</ns:resultsPage> </ns:searchAssetsParam> </soapenv:Body> </soapenv:Envelope> The generated java objects have methods for calling the service, creating the objects and constructing the header. But, I am having trouble setting the header while making the call. Here's the code that I am using: IpsApiService service = new IpsApiService(); IpsApiPortType port = service.getIpsApiSoapPort(); SearchAssetsParam searchAssetsParam = buildSearchAssetsParam(); SearchAssetsReturn response = port.searchAssets(searchAssetsParam); buildSearchAssetsParam() constructs the request object. I created the header object as follows: AuthHeader header = new AuthHeader(); header.setUser("username@gmail.com"); header.setPassword("password1"); How do I set this AuthHeader to the service request? Thanks, Venu
Tags (comma-separated)
Save Edits
Cancel