javax.xml.soap.SOAPException: System.Web.Services.Protocols.
发布时间:2010-06-05 12:41:39 文章来源:www.iduyao.cn 采编人员:星星草
使用javax.xml.soap.*的问题
使用javax.xml.soap.*去访问一个web service服务出问题。源代码如下
package com;
import javax.xml.messaging.URLEndpoint;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPConnection;
import javax.xml.soap.SOAPConnectionFactory;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPFault;
import javax.xml.soap.SOAPMessage;
public class SoapCallService {
private SOAPConnection soapConnection = null;
private boolean initializeSoapConnection()
{
if( soapConnection == null)
{
SOAPConnectionFactory soapConnectionFactory = null;
try
{
soapConnectionFactory = SOAPConnectionFactory.newInstance();
try
{
soapConnectionFactory = SOAPConnectionFactory.newInstance();
}catch(UnsupportedOperationException e){
e.printStackTrace();
}
try
{
soapConnection = soapConnectionFactory.createConnection();
}
catch(SOAPException e)
{
e.printStackTrace();
}
}catch(Exception e){
}
}
return true;
}
public void getResponse()
{
try
{
URLEndpoint urlEndpoint = new URLEndpoint("http://www.webservicex.net/globalweather.asmx?WSDL");
SOAPMessage request = MessageFactory.newInstance().createMessage();
SOAPMessage response = soapConnection.call(request, urlEndpoint);
if(response!=null)
{
SOAPBody responsebody = response.getSOAPBody();
if(responsebody.hasFault())
{
SOAPFault fault = responsebody.getFault();
String faultDescription = fault.getFaultString();
System.out.println("ww:"+faultDescription);
}
}
}catch(Exception e)
{
e.printStackTrace();
}
}
public static void main(String args[]){
SoapCallService soapcall = new SoapCallService();
soapcall.initializeSoapConnection();
soapcall.getResponse();
}
}
结果出问题
- Deploying module: addressing-1.3
javax.xml.soap.SOAPException: System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: urn:anonOutInOp.
at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()
at System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message)
at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)
at org.apache.axis2.saaj.SOAPConnectionImpl.handleSOAPMessage(SOAPConnectionImpl.java:193)
at org.apache.axis2.saaj.SOAPConnectionImpl.call(SOAPConnectionImpl.java:129)
at com.SoapCallService.getResponse(SoapCallService.java:100)
at com.SoapCallService.main(SoapCallService.java:135)
Caused by: org.apache.axis2.AxisFault: System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: urn:anonOutInOp.
at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()
at System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message)
at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:486)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:343)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:389)
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。
其他相似内容:
-
myeclipse上开发j2me的错误提示怎么看(找个好多没有解决的,CSDN能人出来啊......)
对于javame的提示实在无语啊。如下
java.lang.I...
-
命令行执行java程序,含有多个包
我定义了一个java project 叫project1,
然后建立了两个package,(注意都不是jar包)
一个叫animaltestdr...
-
j2me新手问题
import javax.microedition.midlet.MIDlet;
import javax.microedition.lcdui.*;
public class gamestart extends...
-
j2me中如何用代码判断两次pointerPressed之间的时间差?
j2me中如何用代码判断两次pointerPressed之间的时间差?
------解决方案---...
-
通过电脑上wap浏览器可以进入我的wap网站,但是手机不能上,为什么?
我做了wap网站,通过花生壳挂接到外网上了。
通过电脑上wap浏览器可...
-
不含声音文件,如何播放声音?塞班
今天看了一下“飞信JAVA 1.0版”,安装后,信息提示音跟电子音似的。
解压后,发现只有一堆class文件,和...
-
怎么看wtk的源码?高分求助!
我们平时使用eclipse时,点右键选open declaration,或者按F3即可查看源码。现在我建了一个J2ME Midlet工程...
-
如何使用外部js验证下拉列表是否选择
我想使用js对表单进行验证,其中有一个下拉列表,如何验证这个下拉列表在提交的时候已经做过选...
-
关于GUI的一个问题(分不多了,请谅解)
import java.awt.*;
import java.awt.event.*;
import java.util.*;
public class MyMouseAdap...
-
j2me socket读取服务器中文出乱码
conn = (SocketConnection) Connector.open(addr ,Connector.READ_WRITE);
conn.setSocketOpti...