Moin,
ich wollte mal ein SOAP-Beispiel in Java schreiben, scheitere jedoch noch an ein paar Punkten:
package localhost;
import java.net.URL;
import javax.xml.rpc.Service;
import javax.xml.namespace.QName;
import javax.xml.rpc.ServiceFactory;
import org.apache.axis.types.UnsignedShort;
public class SoapTest {
public static void main(String[] args) {
try {
String nameSpaceUri = "http://localhost/";
String serviceName = "IIPSObjectManagerservice";
String portName = "IIPSObjectManagerPort";
// Specify the location of the WSDL file
URL url = new URL("http://<host>:3773/wsdl/IIPSObjectManager");
// Create an instance of service factory
ServiceFactory serviceFactory = ServiceFactory.newInstance();
// Create a service object to act as a factory for proxies.
Service IPSservice = serviceFactory.createService(url,
new QName(nameSpaceUri, serviceName));
localhost.IIPSCategoryManagerProxy myProxy = (localhost.IIPSCategoryManagerProxy) IPSservice.getPort(
new QName(nameSpaceUri, portName), localhost.IIPSCategoryManagerProxy.class);
UnsignedShort foo = myProxy.getCategoryIDByName("Dachgeschoss", (short) 0);
System.out.println("Status: " + foo.toString());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
Als Fehlermeldung kommt:
javax.xml.rpc.ServiceException: Only interfaces may be used for the proxy class argument
at org.apache.axis.client.Service.getPort(Service.java:417)
at org.apache.axis.client.Service.getPort(Service.java:324)
at localhost.SoapTest.main(SoapTest.java:28)
Irgendwie baue ich den Proxy-Request falsch zusammen. Hat da jmd. evtl. einen Hinweis für mich?
Viele Grüße
Sascha