This document was generated from CDN thread
Created by: julien CHODLEWSKI on 04-05-2009 09:53:24 PM
Hello,
I want to use the AXL API with java, so I made the wsdl with eclipse and this gave me AXLAPIServiceStub.java , AXLAPIServiceCallback handler.java (I called them like that) and all of the packages of implementations (com.cisco.www.api.1_0, com.cisco.www.api.1_0.impl, org.w3.www.2004._06.xmlmime, org.w3.www._2004._06.xmlmime.impl, org.xmlsoap.schemas.soap.encoding,org.xmlsoap.schemas.soap.encoding.impl).
I wrote a new class "Test_api". in this class, I made an instance of the stub then I tried to make a soap call (a "listPhoneByDescription" request).
but it doesn't work ... the stub is instanciated, but when I make the soap call I get an NullPointerException. Yet I built the request as I have to do it, i think
i saw in AXLAPIServiceStub.java that this exception came from "_operationClient.execute(true);" in the function "listPhoneByDescription"
In fact I think that I don't understand how to use this stub and where does the credential goes (in the url ?, in the configurationContext ? ).
Here is the code :
package axis;
import java.rmi.RemoteException;
import org.apache.axis2.client.ServiceClient;
import com.cisco.www.axl.api._1_0.*;
public class Test_api {
public static void main(String[] args){
AXLAPIServiceStub axlapi;
try{
org.apache.axis2.context.ConfigurationContext configurationContext= org.apache.axis2.context.ConfigurationContextFactory.createDefaultConfigurationContext();
axlapi = new AXLAPIServiceStub(configurationContext,"https://192.168.130.10:8443/axl/");
System.out.println("test2 :\n\t" + axlapi);
ListPhoneByDescriptionDocument listPhoneByDescription204 = ListPhoneByDescriptionDocument.Factory.newInstance();
ListPhoneByDescriptionReq listPhoneByDescription = ListPhoneByDescriptionReq.Factory.newInstance();
listPhoneByDescription.setSearchString("%");
listPhoneByDescription204.setListPhoneByDescription(listPhoneByDescription);
System.out.println("test3 :\n\t" + listPhoneByDescription204);
try{
ListPhoneByDescriptionResponseDocument responseDocument = axlapi.listPhoneByDescription(listPhoneByDescription204);
}catch(Exception re){
System.out.println("Error ListPhone : \n\t" +re );
}
}catch(Exception e){
System.out.println("Error \n" + e);
}
}
}
and the result :
test2 :
axis.AXLAPIServiceStub@b66cc
test3 :
<listPhoneByDescription xmlns="http://www.cisco.com/AXL/API/1.0">
<searchString xmlns="">%</searchString>
</listPhoneByDescription>
Error ListPhone :
java.lang.NullPointerException
If someone has already use the wsdl in java, or someone else could help me,
Thank you,
Julien