on 03-02-2012 6:27 AM
Hi All,
I am trying to call a MTOM enabled web service from Web Dynpro Java. Can anybody tell how I can do that?
I am trying to write code inside
modelClass.wdSetInvocationModifier(
new IWDWSInvocationModifier() {
public void doModifyInvocation(Object port) {
BindingProvider bp = (BindingProvider) port;
--- It cannot execute the above line . Giving error :
java.lang.ClassCastException: class com.sap.engine.services.webservices.espbase.client.dynamic.impl.DInterfaceInvokerImpl:library:webservices_lib at com.sap.engine.boot.loader.ResourceMultiParentClassLoader 5c546909 alive incompatible with interface javax.xml.ws.BindingProvider:null
SOAPBinding binding = (SOAPBinding)bp.getBinding();
binding.setMTOMEnabled(true);
Thanks in advance
Raktim
HI Raktim,
error msg in your code says incompatible with interface javax.xml.ws.BindingProvider:null
Please check the version compatibility first for portal and nwds as mentioned in below notes. Also see if all required jar files are added.
1473001
1582187
1375439
If version is compatible i.e. 7.02 or 7.20 or above you can check below link for more clarification on using MTOM enable webservice and consumption.
http://www.mkyong.com/webservices/jax-ws/jax-ws-attachment-with-mtom/
Regard
Deepak
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
MTOM is not possible from webdynpo. I wrote a EJB for that.
I wrote following code in EJB, it works:
QName serviceName = new QName(
"http://schemas.mycompany.com/ecm/dctmpswebservice/ecmschema/1.0","DctmPSWebService");
try{
URL url = new URL("http://mycompany.com:9080/dctmpswebservice/services/DctmPSWebService?wsdl") ;
DctmPSWebService_Service service = new DctmPSWebService_Service(url, serviceName);
DctmPSWebService port = service.getDctmPSWebServicePort();
((BindingProvider) port).getRequestContext().put("com.sun.xml.ws.request.timeout", 1000000);
String token = port.authenticate(docbase,
user,
user,
password,
"profsvc");
SOAPHeaderInterface headerControl = SOAPHeaderIFactory.getInterface(port);
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
docBuilderFactory.setNamespaceAware(true);
DocumentBuilder docBuilder;
docBuilder = docBuilderFactory.newDocumentBuilder();
Document doc = docBuilder.newDocument();
Element header = doc.createElementNS("http://schemas.mycompany.com/ecm/dctmpswebservice/ecmschema/1.0", "Header");
Element documentumSecurityToken = doc.createElementNS("http://schemas.mycompany.com/ecm/dctmpswebservice/ecmschema/1.0", "DocumentumSecurityToken");
Element eToken = doc.createElementNS("http://schemas.mycompany.com/ecm/dctmpswebservice/ecmschema/1.0", "token");
eToken.setTextContent(token);
documentumSecurityToken.appendChild(eToken);
header.appendChild(documentumSecurityToken);
// adding token to header. it is a requirement
headerControl.setOutputHeader(null, documentumSecurityToken);
BindingProvider bpr = (BindingProvider) port;
SOAPBinding binding = (SOAPBinding) bpr.getBinding();
binding.setMTOMEnabled(true);
}catch(Exception e){
msg = e.toString();
}
Thanks
Raktim
User | Count |
---|---|
78 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.