[jboss-user] [JBossWS] - howto: soap header wsdl required=true

johper do-not-reply at jboss.com
Mon Dec 17 15:53:55 EST 2007


Tried wsconsume, dont know how to populate ws call with soap header required auth info? This Auth info is passed explicit with stubs generated by Axis2.

Description:


MS WSDL part:
=============
- <wsdl:operation name="GetCustomer">
<soap:operation soapAction="http://ibs.entriq.net/Customers/ICustomersService/GetCustomer" style="document" /> 
- <wsdl:input>
<soap:header wsdl:required="true" message="i0:AuthHeader_Message" part="AuthenticationHeader" use="literal" /> 
<soap:header wsdl:required="true" message="i0:CacheControlHeader_Message" part="CacheControlHeader" use="literal" /> 
<soap:body use="literal" /> 
</wsdl:input>
- <wsdl:output>
<soap:body use="literal" /> 
</wsdl:output>
- <wsdl:fault name="AuthenticationFaultFault">
<soap:fault name="AuthenticationFaultFault" use="literal" /> 
</wsdl:fault>
- <wsdl:fault name="IBSFaultFault">
<soap:fault name="IBSFaultFault" use="literal" /> 
</wsdl:fault>
- <wsdl:fault name="SystemFaultFault">
<soap:fault name="SystemFaultFault" use="literal" /> 
</wsdl:fault>
- <wsdl:fault name="PermissionFaultFault">
<soap:fault name="PermissionFaultFault" use="literal" /> 
</wsdl:fault>
</wsdl:operation>

wsconsume:
===========
wsconsume -k -v -p com.ibs6proxy.customers http://ibsinterprit/ASM/ALL/Customers.svc?wsdl
  
  
wsconsume gen Java Interface:
=============================
@WebMethod(operationName = "GetCustomer", action = "http://ibs.entriq.net/Customers/ICustomersService/GetCustomer")
@WebResult(name = "GetCustomerResult", targetNamespace = "http://ibs.entriq.net/Customers")
@RequestWrapper(localName = "GetCustomer", targetNamespace = "http://ibs.entriq.net/Customers", className = "com.ibs6proxy.customers.GetCustomer")
@ResponseWrapper(localName = "GetCustomerResponse", targetNamespace = "http://ibs.entriq.net/Customers", className = "com.ibs6proxy.customers.GetCustomerResponse")
@Action(input = "http://ibs.entriq.net/Customers/ICustomersService/GetCustomer", output = "http://ibs.entriq.net/Customers/ICustomersService/GetCustomerResponse", fault = {
  @FaultAction(className = ICustomersServiceGetCustomerAuthenticationFaultFaultFaultMessage.class, value = "http://ibs.entriq.net/Customers/ICustomersService/GetCustomerAuthenticationFaultFault"),
  @FaultAction(className = ICustomersServiceGetCustomerIBSFaultFaultFaultMessage.class, value = "http://ibs.entriq.net/Customers/ICustomersService/GetCustomerIBSFaultFault"),
  @FaultAction(className = ICustomersServiceGetCustomerSystemFaultFaultFaultMessage.class, value = "http://ibs.entriq.net/Customers/ICustomersService/GetCustomerSystemFaultFault"),
  @FaultAction(className = ICustomersServiceGetCustomerPermissionFaultFaultFaultMessage.class, value = "http://ibs.entriq.net/Customers/ICustomersService/GetCustomerPermissionFaultFault")
})
public Customer getCustomer(
  @WebParam(name = "customerId", targetNamespace = "http://ibs.entriq.net/Customers")
  Integer customerId)
  throws ICustomersServiceGetCustomerAuthenticationFaultFaultFaultMessage, ICustomersServiceGetCustomerIBSFaultFaultFaultMessage, ICustomersServiceGetCustomerPermissionFaultFaultFaultMessage, ICustomersServiceGetCustomerSystemFaultFaultFaultMessage
;
    
 
Java client code:
=================
com.ibs6proxy.customers.CustomersService cs = new com.ibs6proxy.customers.CustomersService();
com.ibs6proxy.customers.ICustomersService iCustomersService = cs.getBasicHttpBindingICustomersService();

// Get BindingProvider.
//javax.xml.ws.BindingProvider bp = (javax.xml.ws.BindingProvider) iCustomersService;
//bp.getRequestContext().put("AuthenticationHeader", ah2);
//System.out.println("AuthenticationHeader set ...");
// get customer.
com.ibs6proxy.customers.Customer customer = iCustomersService.getCustomer(10840);

This is the exception:
----------------------
com.ibs6proxy.customers.ICustomersServiceGetCustomerAuthenticationFaultFaultFaultMessage: The current identity is not a
BusinessIdentity. No user authenticated.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at org.jboss.ws.metadata.umdm.FaultMetaData.toServiceException(FaultMetaData.java:384)
at org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS.getSOAPFaultException(SOAPFaultHelperJAXWS.java:128)
at org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS.throwFaultException(SOAP11BindingJAXWS.java:109)
at org.jboss.ws.core.CommonSOAPBinding.unbindResponseMessage(CommonSOAPBinding.java:553)
at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:371)
at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:243)
at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:164)
at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:150)
at $Proxy25.getCustomer(Unknown Source)
at WS.main(WS.java:46)


Signature for same method generated by Axis2 (auth param passed explicit) works fine:
=====================================================================================
public com.ibs6proxy.customers.CustomersServiceStub.GetCustomerResponse GetCustomer(
        com.ibs6proxy.customers.CustomersServiceStub.GetCustomer getCustomer,
        com.ibs6proxy.customers.CustomersServiceStub.AuthenticationHeader29 authenticationHeader84,
        com.ibs6proxy.customers.CustomersServiceStub.CacheControlHeader24 cacheControlHeader85)


C# .NET client working fine:
=============================
CustomersService client = new CustomersService();
AuthenticationHeader authHeader = new AuthenticationHeader();
authHeader.UserName = "test";
authHeader.Proof = "test";
authHeader.Dsn = "Training";
client.AuthenticationHeaderValue = authHeader;
Customer customer = client.GetCustomer(10840, true);
MessageBox.Show("from service:" + customer.InternetUserId.ToString());

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4113550#4113550

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4113550



More information about the jboss-user mailing list