Results 1 to 2 of 2
- 04-14-2011, 02:32 PM #1
Member
- Join Date
- Apr 2011
- Posts
- 1
- Rep Power
- 0
WSDL2Java Pass header in the request
Hi' Guys,
First thing I am new to this forum so please excuse me if I have posted this to the wrong place.
My query is for WSDL2Java API,
I have a security header which needs to be passed to the service, I have generated the classes and writing a client which will pass the input to the web service, the service is secured so I need to pass the security header,
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-2" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>weblogic</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">welcome1</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
<v1:GMWSHeader>
<v1:SourceId>String</v1:SourceId>
<v1:TransactionId>String</v1:TransactionId>
<v1:TransactionTimeStamp>1967-08-13</v1:TransactionTimeStamp>
<v1:ServiceVersion>LATEST</v1:ServiceVersion>
</v1:GMWSHeader>
</soapenv:Header>
I have coded this to some extend however when I did a sysout, I found out that the XML which it is passing is not 100% same, I am also getting exception the error logs are as below, alo the java code which I have written to pass this header,
Java code:
/*Set Security Header*/
SOAPHeaderElement securityHeader = new SOAPHeaderElement(namespace1, "Security");
SOAPElement usernametoken = securityHeader.addChildElement("UsernameToken");
usernametoken.setAttributeNS(namespace3, "Id", "UsernameToken-2");
SOAPElement username = usernametoken.addChildElement("Username");
SOAPElement password = usernametoken.addChildElement("Password");
password.setAttribute("Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText");
username.addTextNode("weblogic");
password.addTextNode("welcome1");
((Stub)port).setHeader(securityHeader);
System.out.println("securityHeader :"+securityHeader);
SOAPHeaderElement gmwsheader = new SOAPHeaderElement(namespace2, "GMWSHeader");
SOAPElement SourceId = gmwsheader.addChildElement("SourceId");
SOAPElement TransactionId = gmwsheader.addChildElement("TransactionId");
SOAPElement TransactionTimeStamp = gmwsheader.addChildElement("TransactionTimeStamp") ;
SOAPElement ServiceVersion = gmwsheader.addChildElement("ServiceVersion");
SourceId.addTextNode("String");
TransactionId.addTextNode("String");
TransactionTimeStamp.addTextNode("1967-08-13");
ServiceVersion.addTextNode("LATEST");
((Stub)port).setHeader(gmwsheader);
error log:
[2011-04-14T18:21:40.881+05:30] [OSBServer] [ERROR] [WSM-00006] [oracle.wsm.resources.security] [tid: [ACTIVE].ExecuteThread: '22' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: <anonymous>] [ecid: 0000IxK4IQm1baURM6XBhA1DdcAP00001K,0] [APP: XBus Kernel] [dcid: 7e8d956afafee9bd:5c0a5e76:12f526e310e:-8000-00000000000000f7] [arg: oracle.wsm.security.SecurityException: WSM-00069 : The security header is missing.] Error in receiving the request: oracle.wsm.security.SecurityException: WSM-00069 : The security header is missing..
[2011-04-14T18:21:40.881+05:30] [OSBServer] [ERROR] [WSM-07607] [oracle.wsm.resources.enforcement] [tid: [ACTIVE].ExecuteThread: '22' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: <anonymous>] [ecid: 0000IxK4IQm1baURM6XBhA1DdcAP00001K,0] [APP: XBus Kernel] [dcid: 7e8d956afafee9bd:5c0a5e76:12f526e310e:-8000-00000000000000f7] [arg: {http://schemas.oracle.com/ws/2006/01/securitypolicy}wss-username-token] [arg: oracle.wsm.security.policy.scenario.executor.WssUs ernameTokenScenarioExecutor] Failure in execution of assertion {http://schemas.oracle.com/ws/2006/01/securitypolicy}wss-username-token executor class oracle.wsm.security.policy.scenario.executor.WssUs ernameTokenScenarioExecutor.
[2011-04-14T18:21:40.881+05:30] [OSBServer] [ERROR] [WSM-07602] [oracle.wsm.resources.enforcement] [tid: [ACTIVE].ExecuteThread: '22' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: <anonymous>] [ecid: 0000IxK4IQm1baURM6XBhA1DdcAP00001K,0] [APP: XBus Kernel] [dcid: 7e8d956afafee9bd:5c0a5e76:12f526e310e:-8000-00000000000000f7] Failure in WS-Policy Execution due to exception.
[2011-04-14T18:21:40.881+05:30] [OSBServer] [ERROR] [WSM-07501] [oracle.wsm.resources.enforcement] [tid: [ACTIVE].ExecuteThread: '22' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: <anonymous>] [ecid: 0000IxK4IQm1baURM6XBhA1DdcAP00001K,0] [APP: XBus Kernel] [dcid: 7e8d956afafee9bd:5c0a5e76:12f526e310e:-8000-00000000000000f7] [arg: security] [arg: agent.function.service] [arg: OSBKernel] [arg: null] [arg: CustomerContractEntityService] [arg: oracle/wss_username_token_service_policy] [arg: 1] [arg: {http://schemas.oracle.com/ws/2006/01/securitypolicy}wss-username-token] Failure in Oracle WSM Agent processRequest, category=security, function=agent.function.service, application=OSBKernel, composite=null, modelObj=CustomerContractEntityService, policy=oracle/wss_username_token_service_policy, policyVersion=1, assertionName={http://schemas.oracle.com/ws/2006/01/securitypolicy}wss-username-token.
sysout:
<ns1:Security soapenv:mustUnderstand="0" soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
xmlns:ns1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<ns1:UsernameToken Id="UsernameToken-2">
<ns1:Username>weblogic</ns1:Username>
<ns1:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">welcome1</ns1:Password>
</ns1:UsernameToken>
</ns1:Security>Last edited by yatanveersingh; 04-14-2011 at 02:35 PM.
- 07-26-2011, 11:57 AM #2
Member
- Join Date
- Apr 2011
- Posts
- 22
- Rep Power
- 0
Hay yatanveersingh,
I've read you post with intrest as I've been trying to develop a java client from wsdl, but not getting anywhere. I've used the jaxws-rt to conver the wsdl into a buch of java classes, but along with the wsdl I've got in structions about setting a security header. And thats where I got stuck. The jax-ws output does not provide any api for setting header information!! So consiquently I'm intrested to know what you done to go from wsdl to java.
Did you solve the problem outlined above?
Thanks
Adam
Similar Threads
-
Lightweight WSDL2Java tool
By mm-kk in forum AndroidReplies: 0Last Post: 03-20-2011, 03:00 PM -
Lightweight WSDL2Java tool
By mm-kk in forum CLDC and MIDPReplies: 0Last Post: 03-20-2011, 02:54 PM -
Problem with CXF WSDL2JAVA
By madhu_sushmi in forum Advanced JavaReplies: 0Last Post: 03-06-2010, 12:25 PM -
Header/Footer
By selva.bics in forum New To JavaReplies: 0Last Post: 11-26-2009, 02:26 PM -
Getting Header Info
By Java Tip in forum Java TipReplies: 0Last Post: 11-26-2007, 01:30 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks