Hi Fady,

I am a newbie with web services and axis too. But do you need

to use dynamic invocation interface to access this web service?

I can access the web site with stub code generated by WSDL2Java.



Setup:

windows 2000 with lastest service pack

axis-1_2beta

java version "1.4.1_01"



Output:

C:\axis-1_2beta\samples\test>java -classpath .;C:\axis-1_2beta\samples\test;%CLA

SSPATH% Test

log4j:WARN No appenders could be found for logger (org.apache.axis.i18n.ProjectR

esourceBundle).

log4j:WARN Please initialize the log4j system properly.

1:05 PM



Code:

import com.Nanonull.www.TimeService.*;



public class Test {

        public static void main(String[] args) throws Exception {

                TimeServiceLocator tsl = new TimeServiceLocator();

                TimeServiceSoap  tss  = tsl.getTimeServiceSoap();

                System.out.println(tss.getCityTime("London"));

        }

}





 --- On Thu 08/12, Fady Kaddoum < [EMAIL PROTECTED] > wrote:

From: Fady Kaddoum [mailto: [EMAIL PROTECTED]

To: [EMAIL PROTECTED]

Date: Thu, 12 Aug 2004 11:47:42 +0200

Subject: WebService with a parameter



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML><HEAD>

<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">

<META content="MSHTML 6.00.2800.1106" name=GENERATOR>

<STYLE></STYLE>

</HEAD>

<BODY bgColor=#ffffff>

<DIV><FONT face=Arial size=2>

<DIV><FONT face=Arial size=2>Hello,</FONT></DIV>

<DIV> </DIV>

<DIV><FONT face=Arial size=2>I wrote a small SOAP client to call a .NET web 

service <EM>'getServerTime'</EM> @ <A 

href="http://www.nanonull.com/TimeService/TimeService.asmx";>http://www.nanonull.com/TimeService/TimeService.asmx</A>.
 

It works great. On the other hand, when I call another service 

'<EM>getCityTime</EM>' that needs a parameter, I get an error message 

saying:</FONT></DIV>

<DIV><FONT face=Arial color=#ff0000 size=2>Server was unable to process request. 

--> Object reference not set to an instance of an object.</FONT></DIV>

<DIV><FONT face=Arial color=#ff0000 size=2></FONT> </DIV>

<DIV>

<DIV><FONT face=Arial size=2>Can't figure out what is the 

problem??</FONT></DIV></DIV>

<DIV><FONT face=Arial color=#ff0000 size=2></FONT> </DIV>

<DIV><FONT face=Arial size=2>Here is my code:</FONT></DIV>

<DIV><FONT face=Arial size=2></FONT> </DIV>

<DIV><FONT face=Arial size=2> =========</FONT></DIV>

<DIV><FONT face=Arial size=2>      Service service = 

new Service();<BR>      Call call = (Call) 

service.createCall();</FONT></DIV>

<DIV><FONT face=Arial size=2></FONT> </DIV>

<DIV><FONT face=Arial size=2>      

call.setTargetEndpointAddress(new 

java.net.URL(endpoint));<BR>      

call.setSOAPActionURI("<A 

href="http://www.Nanonull.com/TimeService/getCityTime";>http://www.Nanonull.com/TimeService/getCityTime</A>");</FONT></DIV>

<DIV><FONT face=Arial size=2></FONT> </DIV>

<DIV><FONT face=Arial size=2>      

call.setOperationName("getCityTime");</FONT></DIV>

<DIV><FONT face=Arial size=2></FONT> </DIV>

<DIV><FONT face=Arial size=2>      

call.addParameter("city", org.apache.axis.Constants.XSD_STRING, 

javax.xml.rpc.ParameterMode.IN);<BR>      

call.setReturnType(org.apache.axis.Constants.XSD_STRING);</FONT></DIV>

<DIV><FONT face=Arial size=2></FONT> </DIV>

<DIV><FONT face=Arial size=2>      String ret = 

(String) call.invoke(new Object[] {"LONDON"});</FONT></DIV>

<DIV><FONT face=Arial size=2>=========</FONT></DIV>

<DIV><FONT face=Arial size=2></FONT> </DIV>

<DIV><FONT face=Arial size=2>Thanks!</FONT></DIV>

<DIV><FONT face=Arial size=2>Fady</FONT></DIV></FONT></DIV></BODY></HTML>

<p>

_______________________________________________

Reply via email to