日期:2014-05-20  浏览次数:20867 次

服务器未能识别 HTTP 头 SOAPAction 的值: urn:anonOutInOp?菜鸟初级问题
项目需要,另一家公司提供了webservice使用.net实现的(我看到url是asmx结尾的,应该是.net实现的吧),以前也没有接触过这块,只是用axis2自己试过一些java编写的webservice,这个.net的怎么调用啊?我从网上找了一个例子,自己试试结果报了
Exception in thread "main" org.apache.axis2.AxisFault: 服务器未能识别 HTTP 头 SOAPAction 的值:urn:anonOutInOp。错误。我看了getSupportCityString方法,说明是要求输入一个参数,返回一个字符串数组,实在不明白哪里出了错

import javax.xml.namespace.QName;

import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.rpc.client.RPCServiceClient;
public class TestSession
{
public static void main(String[] args) throws Exception  
  {
   
  RPCServiceClient serviceClient = new RPCServiceClient();
  Options options = serviceClient.getOptions();
   
  String url="http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx";

  EndpointReference targetEPR = new EndpointReference(url);
  options.setTo(targetEPR);

  Object[] opAddEntryArgs = new Object[] {"all"};

  Class[] classes = new Class[] {String[].class};

  QName opAddEntry = new QName("http://WebXml.com.cn", "getSupportCityString");
   
  System.out.println(serviceClient.invokeBlocking(opAddEntry, opAddEntryArgs, classes)[0]);
   
   
  }
}


------解决方案--------------------

我来给你加油~\(^o^)/~
------解决方案--------------------
也不会,期待解答!