[JBoss Web Services] - DII with Document/Literal remote WS from JBoss?
by Ron Olson
Ron Olson [http://community.jboss.org/people/tachoknight] created the discussion
"DII with Document/Literal remote WS from JBoss?"
To view the discussion, visit: http://community.jboss.org/message/558231#558231
--------------------------------------------------------------
Hi all-
I'm trying to work with a document/literal-style web service from my program deployed on 4.2.3, and I keep getting a wsexception error "cannot obtain java mapping for:...". I'm more familar with RPC-style web services, so I'm a little confused about what I have to do to invoke this document-based web service using DII; generating stubs won't work because I'd have to create a new stub/redeploy for each remote service the program works with.
Here is the code I originally wrote and works with RPC-style web services. I've modified it in my attempt to make it work with the document type, but I keep getting the error I mentioned:
URL url = new URL(remoteInfo.getRemoteURL());
String nameSpace = remoteInfo.getRemoteWSNamespace();
QName qname = new QName(nameSpace,
remoteInfo.getRemoteWSServiceName());
QName port = new QName( nameSpace,
remoteInfo.getRemoteWSServicePort());
QName operation = new QName(nameSpace,
remoteInfo.getRemoteWSOperation());
ServiceFactory factory = ServiceFactory.newInstance();
Service service = factory.createService(url, qname);
Call call = service.createCall(port, operation);
call.addParameter("string", javax.xml.rpc.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
call.setReturnType(javax.xml.rpc.encoding.XMLType.XSD_STRING);
call.setProperty(Call.OPERATION_STYLE_PROPERTY, "document");
call.setProperty(Call.SOAPACTION_USE_PROPERTY, "true");
call.setProperty(Call.SOAPACTION_URI_PROPERTY, "");
String realUrl = remoteInfo.getRemoteURL();
call.setProperty(Call.SOAPACTION_URI_PROPERTY, realUrl.substring(0, realUrl.indexOf('?')));
/* Now we actually call the web service */
Object result = call.invoke(new Object[] { dataToDeliver.getDataToSend() });
Thanks for any info!
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/558231#558231]
Start a new discussion in JBoss Web Services at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
15 years, 8 months
Re: [jboss-user] [JBoss Web Services] - setHeader and setServerURL, using javax.xml.ws.Service?
by Kreek Fred
Kreek Fred [http://community.jboss.org/people/fredk] replied to the discussion
"setHeader and setServerURL, using javax.xml.ws.Service?"
To view the discussion, visit: http://community.jboss.org/message/558205#558205
--------------------------------------------------------------
Don't know whether you still need the info, but I found a solution:
(examples uses the sf wsdl, but can be applied in general)
{code}
Soap port = .....
SessionHeader sessionHeader = ......
// Sessionheader properties
QName xmlType = new QName( "urn:enterprise.soap.sforce.com","SessionHeader" );
QName xmlName = new QName( "urn:enterprise.soap.sforce.com","SessionHeader" );
Class<?> javaType = SessionHeader.class
// Register mapping
StubExt stub = (StubExt) port;
TypeMapping mapping = stub.getEndpointMetaData().getServiceMetaData().getTypeMapping();
AbstractSerializerFactory serFactory = new JAXBSerializerFactory();
AbstractDeserializerFactory deserFactory = new JAXBDeserializerFactory();
mapping.register( javaType, xmlType, serFactory, deserFactory );
// Add header to message
stub.addUnboundHeader( xmlName, xmlType, javaType, ParameterMode.IN );
stub.setUnboundHeaderValue( xmlName, this.sessionHeader );
{code}
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/558205#558205]
Start a new discussion in JBoss Web Services at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
15 years, 8 months