Guys, I'm trying to use the TCP protocol on axis. I've already uncommented
the tag on axis2.xml:
transportReceiver name="tcp"
class="org.apache.axis2.transport.tcp.TCPServer">
<parameter name="port">6060</parameter>
If I set the client to invoke "tcp://
127.0.0.1:8080/axis2/services/ShoppingCart" it gives me
"com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog" I think
because of HTTP protocol.
If i set it to "tcp://127.0.0.1:6060/axis2/services/ShoppingCart" it gives
me:
" java.net.ConnectException: Connection refused: connect at
org.apache.axis2.transport.tcp.TCPTransportSender.openTheConnection(TCPTransportSender.java:122)"
error.
Here's my client:
EndpointReference targetEPR = new EndpointReference(
"tcp://127.0.0.1:6060/axis2/services/ShoppingCart");
Options opts = new Options();
opts.setTo(targetEPR );
opts.setTransportInProtocol(Constants.TRANSPORT_TCP);
opts.setAction("urn:createSession");
//engaging addressing
ConfigurationContext ctx =
ConfigurationContextFactory.createConfigurationContextFromFileSystem
("D:\\axis2-1.4.1\\repository", null);
ServiceClient client = new ServiceClient(ctx,null);
client.setOptions(opts);
OMElement testando = client.sendReceive(getPayload());
private static OMElement getPayload() {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace(
"tcp://127.0.0.1:6060/axis2/services/ShoppingCart", "");
OMElement method = fac.createOMElement("createSession", omNs);
OMElement value = fac.createOMElement("Text", omNs);
value.addChild(fac.createOMText(value, "Axis2 Echo String "));
method.addChild(value);
return method;
}
Am I doing something wrong?
And another question, is there a way of using TCP protocol without engaging
addressing? I'm trying to invoke a web service from Jgroups. As it works
over TCP, I'll try to build the SOAP Envelope and send it from another group
member to test if I can invoke the service. This member may not be another
Web service, so I don't know if I'm able to use addressing on it...
Best Regards,
Igor Nogueira