try this ..
String port = "4444"; //port the TCP mon listens
String SOAPAction = "Service"; //service name
String endpoint = "http://127.0.0.1:" + port +
"/service/servlet/AxisServlet";
//create the service
Service service = new Service();
//create the call for the service
call = (Call) service.createCall();
//set the EPR of the call
call.setTargetEndpointAddress(new java.net.URL(endpoint));
//set the URI for SOAPAction
call.setSOAPActionURI(SOAPAction);
//create a Qualified Name
QName method = new QName("someuri", "add");
//set the operation name to the constructed Qualified Name
call.setOperationName(method);
cheers,
Martin Gainty
______________________________________________
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und
Vertraulichkeitanmerkung/Note de déni et de confidentialité
Ez az
üzenet bizalmas. Ha nem ön az akinek szánva volt, akkor kérjük, hogy
jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának
készítése nem megengedett. Ez az üzenet csak ismeret cserét szolgál és
semmiféle jogi alkalmazhatósága sincs. Mivel az electronikus üzenetek
könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet
ezen üzenet tartalma miatt.
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung.
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est
interdite. Ce message sert à l'information seulement et n'aura pas n'importe
quel effet légalement obligatoire. Étant donné que les email peuvent facilement
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité
pour le contenu fourni.
Date: Wed, 2 Mar 2011 15:51:50 -0800
From: [email protected]
Subject: axis2/java service client set operation
To: [email protected]
CC: [email protected]
Hi All,
I am using axis2/java to build a web service client component. I have a
question.
Is there a way to set the operation name in the web service client?
Using axis/j, I can do something like this:
org.apache.axis.client.Service soapService = new
org.apache.axis.client.Service();
soapService.createCall();
call = soapService.getCall();
call.setTargetEndpointAddress(soapAddress);
//setting operation name in the call object
call.setOperationName(new QName(operationNamespace, operationName));
call.setSOAPActionURI(soapAction);
call.setPortName(new QName(portNamespaceURI,portName));
But in axis2/java, I don't see how I can set the operation name in the service
client. I got an exception when trying to do this:
ServiceClient serviceClient = new ServiceClient();
//The following line get an exception, try to set operation name in the
service client
OperationClient operationClient = serviceClient.createClient(new
QName(operationNamespace, operationName));
operationClient.getOptions().setAction(soapAction);
operationClient.getOptions().setTo(new EndpointReference(soapAddress));
operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
operationClient.getOptions().setTransportInProtocol(Constants.TRANSPORT_HTTP);
I understand that the server side might not need the operation name, it can use
soapAction et cetera to figure out where to dispatch the message. But how about
the client doesn't know the soapAction (it might not even have one), all it
know is the operation name, in which case the server will have to rely on the
operation name (as the last resort), right?
Your help is much appreciated.
Gordon