You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Aram Mirzadeh <aw...@mbcli.com> on 2008/03/24 21:58:50 UTC
Client from wsdl2java code
Hello,
Can anyone point me to a completed client that was generated from the
wsdl2java code? I'm new to Java and am having a hard time figuring out
what I need to do after the skeleton has been generated. All of the
samples/examples that I have seen use the java code for the service to
create the client and I have no access to these method.
According to my ethernet sniffer I'm not even sending out any packets at
the moment:
package com.glidesoft.www.client;
import java.rmi.RemoteException;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axis2.AxisFault;
import org.apache.axis2.client.Options;
import com.glidesoft.www.*;
public class insertClient {
public static void main(String[] args) {
try {
GlideStub stub = new
GlideStub("http://www.service-now.com/demo/incident.do?SOAP");
GlideCallbackHandler callback = null;
OMElement result = null;
Options options = stub._getServiceClient().getOptions();
options.setAction("insert");
// option.setUserName("xxx");
// option.setPassword("xxx");
OMElement insertRec = createInsert();
options.setProperty(org.apache.axis2.Constants.Configuration.TRANSPORT_URL,
"http://127.0.0.1:8080/axis2/sn");
stub._getServiceClient().setOptions(options);
stub.startinsert(insertRec, callback);
// result.serializeAndConsume(System.out);
} catch (AxisFault e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
}
}
private static OMElement createInsert() {
OMFactory factory = OMAbstractFactory.getOMFactory();
OMNamespace ns =
factory.createOMNamespace("http://www.glidesoft.com","xsd");
OMElement insertNode = factory.createOMElement("insert",ns);
insertNode.addAttribute("short_description", "this is a new
incident from WS", ns);
return insertNode;
}
}