axis调用webservice发生错误,恳求大神指点

webService的服务器端是用.net写的。我在客户端用java中的axis调用发生错误。
异常如下:
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server
faultSubcode:
faultString: Server was unable to process request. ---> Object reference not set to an instance of an object.
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:Server was unable to process request. ---> Object reference not set to an instance of an object.

WSDL详细如下:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">当有第三方开发人员需要获取本呼叫中心系统报表数据时,可通过本Webservice接口快速的获取指定统计指标的数据集。查询结果通过json的方式返回,由第三方开发人员读取解析。</wsdl:documentation>
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
<s:element name="get_report_data">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="strUid" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="strDateTime_start" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="strDateTime_end" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="strKPI_set" type="s:string"/>
<s:element minOccurs="1" maxOccurs="1" name="nType" type="s:int"/>
<s:element minOccurs="0" maxOccurs="1" name="strMem" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="strFilter" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="get_report_dataResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="get_report_dataResult" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>

<wsdl:message name="get_report_dataSoapIn">
<wsdl:part name="parameters" element="tns:get_report_data"/>
</wsdl:message>
<wsdl:message name="get_report_dataSoapOut">
<wsdl:part name="parameters" element="tns:get_report_dataResponse"/>
</wsdl:message>


<wsdl:portType name="OpenReportSoap">
<wsdl:operation name="get_report_data">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">获取报表指标统计。<BR/><B>strUid</B><BR/>可为空<BR/><B>strDateTime_start</B><BR/>开始时间,格式:yyyy-MM-dd[ HH:mm:ss]<BR/><B>strDateTime_end</B><BR/>结束时间,格式:yyyy-MM-dd[ HH:mm:ss]<BR/><B>strKPI_set</B>&nbsp;&nbsp;<font color='red'>※以现场工程师提供为准</font><BR/>指标编号集合,如:201,202,203<BR/><B>nType</B><BR/>维度类型:72(H)-按时统计,68(D)-按日统计,87(W)-按周统计,77(M)-按月统计,85(U)-按座席工号统计 71(G)-按ACD组统计<BR/><B>strMem</B><BR/>对应的成员集合,如座席工号集合:8601;8602;8603 ACD组号集合:1;2;12;13<BR/><B>strFilter</B><BR/>可为空</wsdl:documentation>
<wsdl:input message="tns:get_report_dataSoapIn"/>
<wsdl:output message="tns:get_report_dataSoapOut"/>
</wsdl:operation>

</wsdl:portType>
<wsdl:binding name="OpenReportSoap" type="tns:OpenReportSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="get_report_data">
<soap:operation soapAction="http://tempuri.org/get_report_data" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>

</wsdl:binding>

<wsdl:service name="OpenReport">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">当有第三方开发人员需要获取本呼叫中心系统报表数据时,可通过本Webservice接口快速的获取指定统计指标的数据集。查询结果通过json的方式返回,由第三方开发人员读取解析。</wsdl:documentation>
<wsdl:port name="OpenReportSoap" binding="tns:OpenReportSoap">
<soap:address location="http://172.16.3.60:8080/ut_report/OpenReport.asmx"/>
</wsdl:port>

</wsdl:service>
</wsdl:definitions>


get_report_data接口说明如下:
获取报表指标统计。
strUid
可为空
strDateTime_start
开始时间,格式:yyyy-MM-dd[ HH:mm:ss]
strDateTime_end
结束时间,格式:yyyy-MM-dd[ HH:mm:ss]
strKPI_set
指标编号集合,如:201,202,203
nType
维度类型:72(H)-按时统计,68(D)-按日统计,87(W)-按周统计,77(M)-按月统计,85(U)-按座席工号统计 71(G)-按ACD组统计
strMem
对应的成员集合,如座席工号集合:8601;8602;8603 ACD组号集合:1;2;12;13
strFilter
可为空


最后,我本地的java代码如下:
package com.my.webservice;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
public class myWebService {
public static void main(String args[]){

try {
String endpoint = "http://172.16.3.60:8080/ut_report/OpenReport.asmx";
Service service=new Service();
Call call=(Call)service.createCall();
call.setTargetEndpointAddress(endpoint);
call.setOperation("get_report_data");
call.addParameter("strUid", XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
call.addParameter("strDateTime_start", XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
call.addParameter("strDateTime_end", XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
call.addParameter("strKPI_set", XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
call.addParameter("nType", XMLType.XSD_INT,javax.xml.rpc.ParameterMode.IN);
call.addParameter("strMem", XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
call.addParameter("strFilter", XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
call.setReturnType(XMLType.XSD_STRING);
call.setUseSOAPAction(true);
call.setSOAPActionURI("http://tempuri.org/get_report_data");
String result=(String)call.invoke(new Object[]{"","2018-06-09","2018-06-12","1",68,"",""});
System.out.println(result);
} catch (Exception e) {
e.printStackTrace();
}

}
}


结果控制台报异常:
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server
faultSubcode:
faultString: Server was unable to process request. ---> Object reference not set to an instance of an object.
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:Server was unable to process request. ---> Object reference not set to an instance of an object.
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:609)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2967)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:327)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:796)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at com.my.webservice.myWebService.main(myWebService.java:25)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

{http://xml.apache.org/axis/}hostname:Albert-PC
...全文
1110 点赞 收藏 1
写回复
1 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
自己来结贴。 研究了一晚,终于弄明白了。正确的代码如下
package com.my.webservice;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;

import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;

public class myWebService {
    public static void main(String args[]){

        try {
            String endpoint = "http://172.16.3.60:8080/ut_report/OpenReport.asmx?wsdl";
            String method="get_report_data";
            String targetNamespace="http://tempuri.org/";
            Service service=new Service();
            Call call=(Call)service.createCall();
            call.setTargetEndpointAddress(new java.net.URL(endpoint));
            call.setOperationName(new QName(targetNamespace,method));
            //必须这样增加参数
            call.addParameter(new QName(targetNamespace,"strUid"),XMLType.XSD_STRING,ParameterMode.IN);
            call.addParameter(new QName(targetNamespace,"strDateTime_start"),XMLType.XSD_STRING,ParameterMode.IN);
            call.addParameter(new QName(targetNamespace,"strDateTime_end"),XMLType.XSD_STRING,ParameterMode.IN);
            call.addParameter(new QName(targetNamespace,"strKPI_set"),XMLType.XSD_STRING,ParameterMode.IN);
            call.addParameter(new QName(targetNamespace,"nType"),XMLType.XSD_STRING,ParameterMode.IN);
            call.addParameter(new QName(targetNamespace,"strMem"),XMLType.XSD_STRING,ParameterMode.IN);
            call.addParameter(new QName(targetNamespace,"strFilter"),XMLType.XSD_STRING,ParameterMode.IN);
            call.setReturnType(XMLType.XSD_STRING);
            call.setUseSOAPAction(true);
            call.setSOAPActionURI("http://tempuri.org/get_report_data");
            call.setEncodingStyle("utf-8");
            String result=(String)call.invoke(new Object[]{null,"2018-06-09","2018-06-12","1",68,null,null});
            System.out.println(result);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2018-06-13 06:38
社区公告
暂无公告