[jboss-user] [JBossWS] - How to provide soapAction from dispatch call?

oskar.carlstedt do-not-reply at jboss.com
Mon Apr 16 11:44:08 EDT 2007


Hello!

I've tried a to fix this for some hours know. Maybe I'm doing something completely wrong here.

I have a web service client that that is using the dispatch technique. I will use the dispatch because I'm using xmlbeans to bind my data. Here is a little code snippet of what I'm trying to do:


  | // names
  | String targetNamespace = "http://test/test-service";
  | QName serviceQName = new QName(targetNamespace, "TestService");
  | QName portQName = new QName(targetNamespace, "TestServiceSoap11Port");
  | URL wsdlURL = new URL("http://lpt-osca:8080/service-testservice-jaxws-web?wsdl");
  | 
  | // create service
  | Service service = Service.create(serviceQName);
  | service.addPort(portQName, SOAPBinding.SOAP11HTTP_BINDING, wsdlURL.toExternalForm());
  | Dispatch<StreamSource> dispatch = service.createDispatch(portQName, StreamSource.class, Mode.PAYLOAD);
  | 
  | // set SOAPAction
  | dispatch.getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, true);
  | dispatch.getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY, "uri:placeBuyOrder");
  | 
  | // create xml options for pretty print
  | XmlOptions xmlOptions = new XmlOptions();
  | xmlOptions.setSavePrettyPrint();
  | 
  | // create request
  | TestRequestDocument testRequestDocument = TestRequestDocument.Factory.newInstance();
  | ...
  | 
  | 
  | // print request
  | System.out.println("REQUEST");
  | testRequestDocument.save(System.out, xmlOptions);
  | System.out.println();
  | 
  | // save request in a stream
  | ByteArrayOutputStream requestByteArrayOutputStream = new ByteArrayOutputStream();
  | testRequestDocument.save(requestByteArrayOutputStream);
  | 
  | // create a new stream source
  | StreamSource requestStreamSource = new StreamSource(new ByteArrayInputStream(requestByteArrayOutputStream.toByteArray()));
  | 
  | // invoke
  | StreamSource responseSource = dispatch.invoke(requestStreamSource);
  | 
  | // parse result
  | XmlObject xmlObject = XmlObject.Factory.parse(responseSource.getInputStream());
  | 
  | // print response
  | System.out.println("RESPONSE");
  | xmlObject.save(System.out, xmlOptions);
  | 

When doing this. it seems like the soap action attribute is not sent to the server, at least not in the http headers. So, my question is: Is the soapAction sent to the sever? If so, where can I find it in the messageContext?

My service is a web service endpoint provider implementation like

  | @Stateless
  | @WebServiceProvider(
  | 		serviceName = "TestService",
  | 		portName = "TestServiceSoap11Port",
  | 		targetNamespace = "http://test/test-service",
  | 		wsdlLocation = "WEB-INF/wsdl/test-service.wsdl")
  | @ServiceMode(value = Service.Mode.PAYLOAD)
  | public class FundOrderEndpointProvider implements Provider<Source> {
  | 
  | 	...
  | 
  | }
  | 
  | 

I will look for the soap action http header to decide what method to invoke in another stateless session bean.

Can anyone help me we this?
Best Regards
Oskar



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

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



More information about the jboss-user mailing list