Prueba1Locator aLocator = new Prueba1Locator();
Prueba1Soap_PortType aPort = aLocator.getprueba1Soap();
int result = aPort.add(1,2);
On Fri, 2005-09-16 at 13:22 +0200, Raúl García wrote:
Hi again,
We just need to make a call to a .net webservice running at another machine,
We have the wsdl (Attached: NewFile.asmx.wsdl)
We create the wdsl using the manual:
java org.apache.axis.wsdl.WSDL2Java NewFile.asmx.wsdl
The generated classes are:
Prueba1.java
Prueba1Locator.java
Prueba1Soap12Stub.java
Prueba1Soap.java
Prueba1SoapStub.java
Our client imports the "longhorn.Prueba1Locator"
// CODE //
public final String prueba(){
String response = null;
boolean ok = true;
try {
Integer num1 = new Integer(2);
Integer num2 = new Integer(5);
String method = "Add";
String url = "" href="http://longhorn/prueba1/NewFile.asmx">http://longhorn/prueba1/NewFile.asmx";
org.apache.axis.client.Service service = new
Prueba1Locator();
org.apache.axis.client.Call call =
(org.apache.axis.client.Call) service.createCall();
QName qnamer = service.getServiceName();
call.setTargetEndpointAddress( new java.net.URL(url) );
call.setOperationName(method);
call.addParameter( "a", XMLType.XSD_INT, ParameterMode.IN
);
call.addParameter( "b", XMLType.XSD_INT, ParameterMode.IN );
call.setReturnType(XMLType.XSD_INT);
response = ((Integer)call.invoke(new Object[] { num1, num2
})).toString();
}
catch(Exception e) {
return "NOK";
}finally{
}
return response;
} // CODE //
The error returned is:
Server did no recognize the value of HTTP Header SOAPAction: .
Where is the problem or what are we doing wrong?
Thanks on advance again
Raúl.
PD: Doing what Felipe Palma suggest seems to create a webservice isn't it?
We neet just the client.
-----Mensaje original-----
De: Felipe Palma Dias [mailto:[EMAIL PROTECTED]]
Enviado el: jueves, 15 de septiembre de 2005 20:35
Para: [email protected]
Asunto: Re: WSDL2Java Newbie Question
1- create a Java interface (MyJavaInterface.java)
2- create the WSDL from java interface.
java org.apache.axis.wsdl.WSDL2Java -o . -s -S true
-Nurn:MyJavaInterface com.sample MyJavaInterface.wsdl
3- creates the stub and skeleton classes:
java org.apache.axis.wsdl.Java2WSDL -o
MyJavaInterface.wsdl -l
http://localhost:8080/axis/services/MyJavaInterface -n
urn:MyJavaInterface com.sample.MyJavaInterface
4- deploy the service:
java -cp $CP org.apache.axis.client.AdminClient
deploy.wsdd
5- put the jar into axis lib
6- restart the tomcat.
--- Raúl García <[EMAIL PROTECTED]> escreveu:
> Hi all,
>
> I need to know how to create the java Proxy to make
> a remote call to a
> webservice.
>
> I know this is a simple action but I cannot
> understand the documentation
> very well.
> Can please someone send us a tutorial or some
> example code to do that?
>
> Thanks on advance
> Regards
> Raúl
>
>
>
Felipe F. Palma Dias - São Paulo/SP
http://www.palmadias.com.br
MSN: [EMAIL PROTECTED]
Yahoo: palmadias
Mobile: +55 11 99157578
_______________________________________________________
Novo Yahoo! Messenger com voz: ligações, Yahoo! Avatars, novos emoticons e
muito mais. Instale agora!
www.yahoo.com.br/messenger/
