Apache Axis
Hej,Jeg har følgende klasse, som benyttes til at kalde en .NET WS.
import .......
public class Main2 {
public static void main( String[] args ) {
String endpoint = "http://localhost:8080/service/service1.asmx";
Service service =
null;
service = new Service(); //new Service("http://localhost:8080/service/service1.asmx?WSDL", new QName( "http://xp/abc/", "Service1" ) );
Call call = null;
//service.createCall();
try {
call = ( Call ) service.createCall();//( Call ) service.createCall(new QName("Service1Soap"), "ListWebSites");
}
catch ( ServiceException e ) {
e.printStackTrace(); //To change body of catch statement use Options | File Templates.
}
try {
call.setTargetEndpointAddress( new java.net.URL( endpoint ) );
}
catch ( MalformedURLException e ) {
e.printStackTrace(); //To change body of catch statement use Options | File Templates.
}
call.setOperationName( "ListWebSites" );
call.setSOAPActionURI( "http://xp/abc/ListWebSites" );
call.setReturnType( XMLType.XSD_STRING );
call.setUsername( "xxxx" );
call.setPassword( "123456" );
System.out.println( "EncodingStyle: " + call.getEncodingStyle() );
try {
Object ret = ( Object ) call.invoke( new Object[]{""} );
System.out.println( "Got result : " + ret );
}
catch ( RemoteException e ) {
e.printStackTrace(); //To change body of catch statement use Options | File Templates.
}
}
}
men får:
- Exception:
org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
at org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDeserializer.java:188)
at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:893)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:200)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:684)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:241)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:265)
at org.apache.axis.client.Call.invoke(Call.java:1871)
at org.apache.axis.client.Call.invoke(Call.java:1777)
at org.apache.axis.client.Call.invoke(Call.java:1315)
at Main2.main(Main2.java:56)
Jeg kan ved hjælp af en 'sniffer' se, at metoden bliver kaldt korrekt og at den korrekte xml bliver sendt tilbage af WS, men min applikation kan ikke forholde sig til denne data.
Hvad kan jeg gøre?
