Skip to main content

BPEL Process Soap Client Error

1 reply [Last post]
cristinabotez
Offline
Joined: 2009-08-27
Points: 0

Here is what I attempted to do:

I created a BPEL process using a user defined client interface, which was a Web service generated with Apache CXF (I created an interface containing a method that took three Strings and returns a String, generated a WSDL file with java2ws and then generated the classes using wsdl2java. I implemented the interface and then I created a WAR archive and deployed it with JBOSS).

I created the BPEL process and it works fine in the BPEL console.

I took the wsdl file given in the BPEL console for my process and generated java classes using wsdl2java.

In Eclipse I set the program arguments to the wsdl URL given in the BPEL console and executed the client and it generated the following error:

27.08.2009 22:35:20 org.apache.cxf.phase.PhaseInterceptorChain doIntercept
INFO: Interceptor has thrown exception, unwinding now Could not send Message.
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Could not send Message.
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:145)
at $Proxy38.process(Unknown Source)
at clientinterface.TranslationClientInterface_TranslationClientInterface_Client.main(TranslationClientInterface_TranslationClientInterface_Client.java:58)
Caused by: org.apache.cxf.interceptor.Fault: Could not send Message.
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:226)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:469)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:299)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:251)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
... 2 more
Caused by: java.io.IOException: /TranslationClientInterface
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2026)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1980)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1905)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:600)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
... 8 more

This is the client class:

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;

/**
* This class was generated by Apache CXF 2.1.4
* Thu Aug 27 22:24:25 EEST 2009
* Generated source version: 2.1.4
*
*/

public final class TranslationClientInterface_TranslationClientInterface_Client {

private static final QName SERVICE_NAME = new QName("http://clientinterface", "TranslationClientInterfaceService");

private TranslationClientInterface_TranslationClientInterface_Client() {
}

public static void main(String args[]) throws Exception {
URL wsdlURL = TranslationClientInterfaceService.WSDL_LOCATION;
if (args.length > 0) {
File wsdlFile = new File(args[0]);
try {
if (wsdlFile.exists()) {
wsdlURL = wsdlFile.toURI().toURL();
} else {
wsdlURL = new URL(args[0]);
}
} catch (MalformedURLException e) {
e.printStackTrace();
}
}

TranslationClientInterfaceService ss = new TranslationClientInterfaceService(wsdlURL, SERVICE_NAME);
TranslationClientInterface port = ss.getTranslationClientInterface();

{
System.out.println("Invoking process...");
java.lang.String _process_senderNr = "1234567890";
java.lang.String _process_receiverNr = "7895140235";
java.lang.String _process_message = "tr:en:Je suis un garcon";
java.lang.String _process__return = port.process(_process_senderNr, _process_receiverNr, _process_message);
System.out.println("process.result=" + _process__return);

}

System.exit(0);
}

}

I couldn't find any link in English about this problem and I would very much appreciate your help.

Thanks,
Cristina

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
cristinabotez
Offline
Joined: 2009-08-27
Points: 0

I found another way to write a Soap Client. Here it is:

- [u]the Java class[/u]:

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.rmi.RemoteException;
import java.util.Map;
import java.util.Properties;
import org.w3c.dom.Element;
import oracle.xml.parser.v2.XMLElement;
import com.oracle.bpel.client.Locator;
import com.oracle.bpel.client.ServerException;
import com.oracle.bpel.client.dispatch.IDeliveryService;
import com.oracle.bpel.client.NormalizedMessage;

public class SoapClientInvocation {

private static final String PROPERTIES_FILE="context.properties";

public String invokeBpelProcess(String senderNr, String receiverNr, String message) throws SoapClientException
{
String bpelResponse=null;
try{
Properties properties=new java.util.Properties();
FileInputStream in = new FileInputStream(new File(PROPERTIES_FILE));
properties.load(in);

String requestXml="[b]the input parameters given in xml format (copy it from the BPEL Console)[/b]"

Locator locator=new Locator(properties.getProperty("domain"),properties.getProperty("java.naming.security.credentials"),properties);
IDeliveryService deliveryService=(IDeliveryService)locator.lookupService(IDeliveryService.SERVICE_NAME);

NormalizedMessage nm=new NormalizedMessage();
nm.addPart("[b]parameters[/b]",requestXml);
[b]/* if you created an [u]empty[/u] BPEL process you do not have to modify anything
if you created a [u]synchronuous[/u] BPEL process you must write [i]payload[/i] instead of [i]parameters[/i] */[/b]
NormalizedMessage response=deliveryService.request("[b]The name of your BPEL process[/b]","[b]The name of the function used by the BPEL process (for a [u]synchronuous[/u] BPEL process the function name is [i]process[/i])[/b]",nm);
Map payload=response.getPayload();

XMLElement xmlResponse=(XMLElement)payload.get("[b]parameters[/b]");
[b]/*again write [i]payload[/i] instead of [i]parameters[/i] for [u]synchronuos[/u] BPEL processes*/[/b]
Element partElement=(Element)xmlResponse.getChildrenByTagName("[b]The name of the tag in the response given by the BPEL process (for [u]synchronuous[/u] processes it is [i]result[/i])[/b]").item(0);
bpelResponse=partElement.getChildNodes().item(0).getNodeValue();

}catch (ServerException se){
throw new SoapClientException(se.getMessage());
} catch (RemoteException re) {
throw new SoapClientException(re.getMessage());
} catch (IOException ioe) {
throw new SoapClientException(ioe.getMessage());
}
String responseMessage=ReturnCode.getMessage(bpelResponse);
return responseMessage;
}
}

- [u]the .properties file[/u]:

orabpel.platform=ias_10g
java.naming.factory.initial=com.evermind.server.rmi.RMIInitialContextFactory
java.naming.provider.url=opmn:ormi://[b]127.0.0.1:6003:oc4j_soa[/b]/orabpel
java.naming.security.principal=oc4jadmin
java.naming.security.credentials=password
dedicated.connection=true
domain=default

[b]127.0.0.1[/b] - address with which you connect to the BPEL Console (not necessarily localhost)
[b]6003[/b] - it is always this port, unless you explicitly modified it
[b]oc4j_soa[/b] - to find out if this fits your settings, go to the Application Server Controle in Oracle SOA Suit and verify the OC4J instance under the Groups section

This .properties file must be copied in $JBOSS_HOME/bin when you will deploy the service.

- [u]you'll also need the following .jar files[/u]: connector15.jar, ejb.jar, oc4j-internal.jar, optic.jar, orabpel.jar, orabpel-ant.jar, orabpel-boot.jar, orabpel-common.jar, orabpel-exts.jar, orabpel-thirdparty.jar, oracle_http_client.jar, orawsdl.jar, xmlparserv2.jar

You'll find these in different directories (usually in lib directories) where Oracle SOA Suite was installed or in JDeveloper.