Topic
  • No replies
adbdkb2
adbdkb2
3 Posts

Pinned topic JAX-WS equivalent for JAX-RPC calls for handlers

‏2012-09-05T23:47:54Z |
I am in the process of converting a JAX_RPC webservice to a JAX-WS service. The JAX-RPC service has a handler that has two methods and I am looking for JAX_WS equivalents of those.

The methods in question are

com.ibm.ws.webservices.engine.MessageContext.getCurrentThreadsContext().getOperation().getName();

AND

// Get the IBM extended MessageContext
com.ibm.wsspi.webservices.rpc.handler.MessageContext extMC = (com.ibm.wsspi.webservices.rpc.handler.MessageContext) context;

// Get the RPCContext from the MessageContext
com.ibm.wsspi.webservices.rpc.handler.RPCContext rpcContext = extMC.getRPCContext();

// Get the WSDL Operation name from the RPCContext
String wsdlOperation = rpcContext != null ? rpcContext.getWSDLOperation() : "N/A";
I tried to search on developerworks and other places but with no success

These are the complete methods that use above calls

private String getMethodName(MessageContext mc) {
String operationName = "";

try {
SOAPMessageContext messageContext = (SOAPMessageContext) mc;

// assume the operation name is the first element
// after SOAP:Body element
Iterator i = messageContext.getMessage().getSOAPPart().getEnvelope().getBod().getChildElements();
while (i.hasNext()) {
Object obj = i.next();
if (obj instanceof SOAPElement) {
SOAPElement e = (SOAPElement) obj;
operationName = e.getElementName().getLocalName();
break;
}
}
} catch (Exception e) {
e.printStackTrace();
}
operationName += "/" + com.ibm.ws.webservices.engine.MessageContext.getCurrentThreadsContext().getOperation().getName();
return operationName;
}
/**
* @param context
* @return
*/

private String getWSDLOperationName(MessageContext context) {
// Get the IBM extended MessageContext
com.ibm.wsspi.webservices.rpc.handler.MessageContext extMC =
(com.ibm.wsspi.webservices.rpc.handler.MessageContext) context;

// Get the RPCContext from the MessageContext
com.ibm.wsspi.webservices.rpc.handler.RPCContext rpcContext = extMC.getRPCContext();

// Get the WSDL Operation name from the RPCContext
String wsdlOperation = rpcContext != null ? rpcContext.getWSDLOperation() : "N/A";

log.debug(" wsdlOperation " + wsdlOperation);
return wsdlOperation;
}
Hopefully someone has found a solution to these calls

Thanks