package test;import javax.xml.namespace.QName;import org.apache.axis.client.Call;
import org.apache.axis.client.Service;public class Test { /**
* @param args
*/
public static void main(String[] args) {
Object[] orderinfo=new Object[2];
orderinfo[0]="北京";
orderinfo[1]=2;
String str = "";
try {
String url = "http://www.ayandy.com/Service.asmx";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(url));
call.setOperationName(new QName("http://tempuri.org/", "getWeatherbyCityName"));
call.addParameter(new QName("http://tempuri.org/", "theCityName"),org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
call.addParameter(new QName("http://tempuri.org/", "theDayFlag"),org.apache.axis.encoding.XMLType.XSD_INTEGER,javax.xml.rpc.ParameterMode.IN);
call.setUseSOAPAction(true);
call.setSOAPActionURI("http://tempuri.org/getWeatherbyCityName");
call.invoke(new Object[]{"常州","Today"}); } catch (Exception e) {
System.out.println("asdf");
e.printStackTrace();
}
System.out.println(str);
}
}程序执行后会有异常如下:
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.请各位高手帮我一下,谢谢
import org.apache.axis.client.Service;public class Test { /**
* @param args
*/
public static void main(String[] args) {
Object[] orderinfo=new Object[2];
orderinfo[0]="北京";
orderinfo[1]=2;
String str = "";
try {
String url = "http://www.ayandy.com/Service.asmx";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(url));
call.setOperationName(new QName("http://tempuri.org/", "getWeatherbyCityName"));
call.addParameter(new QName("http://tempuri.org/", "theCityName"),org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
call.addParameter(new QName("http://tempuri.org/", "theDayFlag"),org.apache.axis.encoding.XMLType.XSD_INTEGER,javax.xml.rpc.ParameterMode.IN);
call.setUseSOAPAction(true);
call.setSOAPActionURI("http://tempuri.org/getWeatherbyCityName");
call.invoke(new Object[]{"常州","Today"}); } catch (Exception e) {
System.out.println("asdf");
e.printStackTrace();
}
System.out.println(str);
}
}程序执行后会有异常如下:
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.请各位高手帮我一下,谢谢
解决方案 »
- 最简单的hibernate程序运行出错
- <html:text property=".."/> 无法显示 在线等大虾帮忙
- 【难题求助】支持千万级并发访问的那种服务器设计需要经验还是技术?
- 我晕了。hibernate如何才能取到数据库中的主键阿?
- 怎么在tomcat下使用log4j
- 高分求助 struts存入数据库时的中文问题 急啊!!!!!!!
- 我是Struts初学者,有些问题不解,望指点!
- 菜鸟提问~~~~有关import的问题
- 关于struts的配置问题,不要灌水
- 如何配置EJB服务器
- 用IO如何读取excel,我写了方法只能读Txt的文件?以下是我的代码..
- 一个数组类型的参数的通用性问题
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_SCHEMA);
Schema result= (Schema)call.invoke(new Object[]{"常州","Today"});
for (MessageElement messageElement : result.get_any()) {
System.out.println(messageElement.getAsString());
}