我试图在java中从eclipse调用opentaps的web服务。我有代码
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL("url"));
call.setOperationName(new QName("quickCreateCustomer", "quickCreateCustomer"));
call.addParameter("emailAddress", org.apache.axis.Constants.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
call.addParameter("firstName", org.apache.axis.Constants.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
call.addParameter("lastName", org.apache.axis.Constants.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
call.addParameter("login.password", org.apache.axis.Constants.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
call.addParameter("login.username", org.apache.axis.Constants.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
call.setReturnType(org.apache.axis.Constants.XSD_STRING);
Object responseWS = call.invoke(new Object[] { "mail_id", "s", "h", "pwd", "user_name" });
System.out.println("ReceivingResponse: " + (String) responseWS);
output = call.getOutputParams();
但它给出了运行时错误,
- Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
- 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:145)
at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
at org.apache.axis.client.Call.invoke(Call.java:2448)
at org.apache.axis.client.Call.invoke(Call.java:2347)
at org.apache.axis.client.Call.invoke(Call.java:1804)
at TriongleJava.main(TriongleJava.java:36)
org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
就行了
Object responseWS = call.invoke(new Object[] { "mail_id", "s", "h", "pwd", "user_name" });
由于我是Java的新手,我不知道如何删除它,甚至我也不知道错误的原因。
答案 0 :(得分:2)
我们的团队在使用轴1.4.1访问Web服务时遇到了同样的错误,问题是由于更高版本的JRE即JRE 1.6.0_37。使用JRE 1.6.0时,它开始在Eclipse Java项目和工作中使用。 Jetty网络应用程序。
干杯, Nisanth
答案 1 :(得分:1)
好像你错过了JavaMail包(mail.jar
和activation.jar
)的运行时相关性。