Java SOAP-Request

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

Ergebnis:

Es sollte wie folgt aussehen:

            localhost.IIPSCategoryManager myProxy =
            	(localhost.IIPSCategoryManager) service.getPort(
            			new QName(nameSpaceUri, portName),
            			localhost.IIPSCategoryManager.class);

Nun habe ich jedoch das Problem, dass für einige Funktionen ein UnsignedShort für IDS benötigt wird.

UnsignedShort wird von Java jedoch so nicht angeboten.
Jemand eine Idee wie ich das in Java „casten“ kann?

        System.out.println("DEBUG: " + 
        		myProxy.getCategoryIDByName("Heizungssteller ABZ", 11512));

Wirft

The method getCategoryIDByName(String, UnsignedShort) in the type IIPSCategoryManager is not applicable for the arguments (String, int)

Viele Grüße
Sascha

Google schlägt zum Beispiel das oder das und noch vieles andere vor.
Ich würde mir eine neue Klasse mit diesem Namen generieren und die Bytes als Array dort reinschreiben. Probiert habe ich es freilich nicht.

Tommi