`
Jacky程熙
  • 浏览: 1077 次
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论

Java代码中利用apache.axis包调用 WebService 报Server Error错误,Java代码中根据WebService参数需要怎么解析设置

阅读更多

Java代码中利用apache.axis包调用 WebService 报Server Error错误,Java代码中根据WebService参数需要怎么解析设置?

WebService 代码如下:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:p1="http://battery.com/OA/PT02PIC" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="SI_PT02PIC" targetNamespace="http://atlbattery.com/OA/PT02PIC">
    <wsdl:documentation/>
    <wsdl:types>
        <xsd:schema targetNamespace="http://battery.com/OA/PT02PIC" xmlns="http://battery.com/OA/PT02PIC" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
            <xsd:element name="MT_PT02PIC" type="DT_PT02PIC"/>
            <xsd:element name="MT_PT02PIC_REQ" type="DT_PT02PIC_REQ"/>
            <xsd:complexType name="DT_PT02PIC_REQ">
                <xsd:annotation>
                    <xsd:appinfo source="http://sap.com/xi/VersionID">df595fa2460711e4c39d000000429b5e</xsd:appinfo>
                </xsd:annotation>
                <xsd:sequence>
                    <xsd:element name="L_SUBRC">
                        <xsd:annotation>
                            <xsd:appinfo source="http://sap.com/xi/TextID">3ed9e744454311e4b98820107a6cb7a5</xsd:appinfo>
                            <xsd:documentation>S:成功   E:失败</xsd:documentation>
                        </xsd:annotation>
                        <xsd:simpleType>
                            <xsd:restriction base="xsd:string">
                                <xsd:length value="1"/>
                            </xsd:restriction>
                        </xsd:simpleType>
                    </xsd:element>
                    <xsd:element name="L_MESSAGE">
                        <xsd:annotation>
                            <xsd:appinfo source="http://sap.com/xi/TextID">b4fe0f7b460711e4a7b220107a6cb7a5</xsd:appinfo>
                            <xsd:documentation>消息</xsd:documentation>
                        </xsd:annotation>
                        <xsd:simpleType>
                            <xsd:restriction base="xsd:string">
                                <xsd:maxLength value="255"/>
                            </xsd:restriction>
                        </xsd:simpleType>
                    </xsd:element>
                </xsd:sequence>
            </xsd:complexType>
            <xsd:complexType name="DT_PT02PIC">
                <xsd:annotation>
                    <xsd:appinfo source="http://sap.com/xi/VersionID">20825fc9462211e4c168000000429b5e</xsd:appinfo>
                </xsd:annotation>
                <xsd:sequence>
                    <xsd:element name="SYSNAME">
                        <xsd:annotation>
                            <xsd:appinfo source="http://sap.com/xi/TextID">ab3bba74454211e4978a20107a6cb7a5</xsd:appinfo>
                            <xsd:documentation>ATL OR  CATL</xsd:documentation>
                        </xsd:annotation>
                        <xsd:simpleType>
                            <xsd:restriction base="xsd:string">
                                <xsd:minLength value="3"/>
                                <xsd:maxLength value="4"/>
                            </xsd:restriction>
                        </xsd:simpleType>
                    </xsd:element>
                    <xsd:element name="MAKEY">
                        <xsd:annotation>
                            <xsd:appinfo source="http://sap.com/xi/TextID">20b9f767454311e4cc6d20107a6cb7a5</xsd:appinfo>
                            <xsd:documentation>资料主ID</xsd:documentation>
                        </xsd:annotation>
                        <xsd:simpleType>
                            <xsd:restriction base="xsd:string">
                                <xsd:maxLength value="20"/>
                            </xsd:restriction>
                        </xsd:simpleType>
                    </xsd:element>
                    <xsd:element name="KMURL">
                        <xsd:annotation>
                            <xsd:appinfo source="http://sap.com/xi/TextID">20b9f769454311e4802820107a6cb7a5</xsd:appinfo>
                            <xsd:documentation>KM访问地址</xsd:documentation>
                        </xsd:annotation>
                        <xsd:simpleType>
                            <xsd:restriction base="xsd:string">
                                <xsd:maxLength value="255"/>
                            </xsd:restriction>
                        </xsd:simpleType>
                    </xsd:element>
                    <xsd:element name="FILENAME">
                        <xsd:annotation>
                            <xsd:appinfo source="http://sap.com/xi/TextID">8051361c460711e4bf3c20107a6cb7a5</xsd:appinfo>
                            <xsd:documentation>文件名</xsd:documentation>
                        </xsd:annotation>
                        <xsd:simpleType>
                            <xsd:restriction base="xsd:string">
                                <xsd:maxLength value="200"/>
                            </xsd:restriction>
                        </xsd:simpleType>
                    </xsd:element>
                </xsd:sequence>
            </xsd:complexType>
        </xsd:schema>
    </wsdl:types>
    <wsdl:message name="MT_PT02PIC">
        <wsdl:documentation/>
        <wsdl:part name="MT_PT02PIC" element="p1:MT_PT02PIC"/>
    </wsdl:message>
    <wsdl:message name="MT_PT02PIC_REQ">
        <wsdl:documentation/>
        <wsdl:part name="MT_PT02PIC_REQ" element="p1:MT_PT02PIC_REQ"/>
    </wsdl:message>
    <wsdl:portType name="SI_PT02PIC">
        <wsdl:documentation/>
        <wsdl:operation name="SI_PT02PIC">
            <wsdl:documentation/>
            <wsp:Policy>
                <wsp:PolicyReference URI="#OP_SI_PT02PIC"/>
            </wsp:Policy>
            <wsdl:input message="p1:MT_PT02PIC"/>
            <wsdl:output message="p1:MT_PT02PIC_REQ"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="SI_PT02PICBinding" type="p1:SI_PT02PIC">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
        <wsdl:operation name="SI_PT02PIC">
            <soap:operation soapAction="http://sap.com/xi/WebService/soap1.1" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
            <wsdl:input>
                <soap:body use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="SI_PT02PICService">
        <wsdl:port name="HTTP_Port" binding="p1:SI_PT02PICBinding">
            <soap:address location="http://ndsapd111.atlbattery.com:50900/XISOAPAdapter/MessageServlet?senderParty=&amp;senderService=BS_OA&amp;amp;receiverParty=&amp;amp;receiverService=&amp;amp;interface=SI_PT02PIC&amp;interfaceNamespace=http%3A%2F%2Fatlbattery.com%2FOA%2FPT02PIC" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
        </wsdl:port>
        <wsdl:port name="HTTPS_Port" binding="p1:SI_PT02PICBinding">
            <soap:address location="https://ndsapd111.atlbattery.com:50901/XISOAPAdapter/MessageServlet?senderParty=&;amp;senderService=BS_OA&amp;receiverParty=&amp;amp;receiverService=&amp;interface=SI_PT02PIC&amp;interfaceNamespace=http%3A%2F%2Fatlbattery.com%2FOA%2FPT02PIC" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
        </wsdl:port>
    </wsdl:service>
    <wsp:UsingPolicy wsdl:required="true"/>
    <wsp:Policy wsu:Id="OP_SI_PT02PIC"/>
</wsdl:definitions>

 

Java代码如下:

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

import javax.xml.rpc.ParameterMode;
import javax.xml.rpc.ServiceException;
import javax.xml.namespace.QName;
import java.net.URL;

public class Main {

    public static void main(String[] args) {
      

        try {
        String endpoint = "http://ndsapd111.atlbattery.com:50900/XISOAPAdapter/MessageServlet?senderParty=&amp;senderService=BS_WIP&amp;receiverParty=&amp;amp;amp;receiverService=&amp;interface=SI_FICTR&amp;interfaceNamespace=http%3A%2F%2Fatlbattery.com%2FWIP%2FFICTR_SEARCH";
        Service  service = new Service();      
        Call call = (Call) service.createCall();
        call.setTargetEndpointAddress( new java.net.URL(endpoint) );
        call.setOperationName( "SI_FICTR" );      
        call.setOperationName(new QName(endpoint, "SI_FICTR"));     
        System.out.println(call);
        call.addParameter("SYSNAME", XMLType.XSD_STRING, ParameterMode.IN);      
        call.addParameter("BUKRS", XMLType.XSD_STRING, ParameterMode.IN);      
        call.setUsername("CX");
        call.setPassword("123456");
      
        call.setReturnType( XMLType.QNAME_LITERAL_ITEM );     

        String ret = (String) call.invoke(new Object[] { "ATL","1030" });
      
        System.out.println(ret);

      
      
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
      
      
    }

}

 

报错截图:[img=http://img.bbs.csdn.net/upload/201503/18/1426689718_459371.jpg][/img]

报错内容如下:

- Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
org.apache.axis.client.Call@6be46e8f
1
AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server
 faultSubcode:
 faultString: Server Error
 faultActor:
 faultNode:
 faultDetail:
    {http://sap.com/xi/WebService/xi2.0}SystemError:
          <context>XIAdapter</context>
          <code>ADAPTER.JAVA_EXCEPTION</code>
          <text><![CDATA[
com.sap.aii.af.service.cpa.CPAObjectNotFoundException: Couldn't retrieve inbound binding for the given P/S/A values: FP=;TP=;FS=null;TS=;AN=null;ANS=null;
    at com.sap.aii.af.service.cpa.impl.lookup.CommonLookup.getInboundBinding(CommonLookup.java:250)
    at com.sap.aii.af.service.cpa.impl.lookup.CommonLookup.getInboundBinding(CommonLookup.java:171)
    at com.sap.engine.core.thread.execution.Executable.run(Executable.java:101)
    at com.sap.engine.core.thread.execution.CentralExecutor$SingleThread.run(CentralExecutor.java:328)
          ]]></text>
      

Server Error
    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.impl.XMLDocumentScannerImpl.next(Unknown Source)
    at org.apache.axis.client.Call.invoke(Call.java:1812)
    at Main.main(Main.java:34)

 


我估计是Java中OperationName的问题,我修改了OperationName的设置,就会报类似返回的类型不匹配的错误。如下图:

Java报错

所以在我已经有了WSDL文件的基础上,我怎么从WSDL文件中获取我JAVA代码所要设置参数的属性,求大神解答?
或者以上问题如何解决,可以让我不报错,成功返回消息。


正确返回的内容应该如下,是一个XML结构的内容。


求大神解答,帮忙解决,急需啊~

分享到:
评论

相关推荐

    抛出无法找到主类:org.apache.axis.wsdl.WSDL2Java

    抛出无法找到主类:org.apache.axis.wsdl.WSDL2Java(Throws Could not find main class: org.apache.axis.wsdl.WSDL2Java)。 添加本文的jar包压缩包解压出来的所有jar包到当前使用的java.exe 命令的lib目录下的ext...

    axis2.jar 解决 org.apache.axis2.util.JavaUtils.callStackToString问题

    &lt;Call Stack = DEBUG_FRAME = org.apache.axis2.util.JavaUtils.callStackToString(JavaUtils.java:564) DEBUG_FRAME = org.apache.axis2.description.ParameterIncludeImpl.debugParameterAdd(ParameterIncludeImpl...

    org.apache.axis jar

    4. **服务部署**:`org.apache.axis.jar`中的类用于处理服务的部署,包括解析WSDL文件,生成服务处理逻辑,以及将服务发布到应用服务器上。 5. **客户端调用**:对于Web服务的消费者,Axis提供了解析WSDL并生成...

    org.apache.axis2.jar

    org.apache.axis2.jar

    axis2解决 org.apache.axis2.util.JavaUtils.callStackToString问题

    在开发基于Axis2的Web服务时,可能会遇到各种错误和异常,其中之一就是与`org.apache.axis2.util.JavaUtils.callStackToString`相关的问题。这个问题通常出现在Axis2尝试获取并打印堆栈跟踪信息时。 `...

    AXIS2远程调用WebService示例(Eclipse+AXIS2)工具和所用包.rar

    AXIS2远程调用WebService是Java开发者在进行分布式服务交互时常用的一种技术。本文将详细介绍如何使用Eclipse集成开发环境和AXIS2框架创建并调用WebService。首先,我们需要准备以下基础工具: 1. Eclipse IDE:这...

    java 调用https webservice实例及axis包

    通常包括`axis.jar`, `axis-ant.jar`, `commons-discovery.jar`, `commons-logging.jar`, `jaxrpc.jar`, `saaj.jar`等。 2. **生成客户端代理类**:使用Axis的`wsdl2java`工具,从Web Service的WSDL(Web Service...

    org.apache.axis

    "org.apache.axis"通常指的是Axis库的核心组件,这个jar包包含了实现这些功能所需的类和接口。 在Java世界中,Web服务是一种通过HTTP协议进行通信的软件系统,它允许不同平台上的应用之间交换数据。Apache Axis ...

    axis2客户端调用webService接口,精简jar包

    在实际应用中,为了调用Web服务,我们通常需要引用一系列的Axis2相关的jar包。然而,这些jar包往往数量众多,可能会增加项目的体积。为了解决这个问题,可以对jar包进行精简,只保留必要的依赖。在标题和描述中提到...

    java调用webservice的axis2.jar包

    Java调用WebService是Web服务交互的一种常见方式,而Axis2是一个高效的、可扩展的Web服务框架,它在Java世界中广泛用于创建和消费Web服务。本文将深入探讨使用Axis2.jar包来调用WebService的相关知识点。 一、Axis2...

    JAVA调JAVA调用webservice(axis方式).doc 用webservice(axis方式).doc

    示例代码中的导入语句包括`javax.xml.namespace.QName`、`org.apache.axis.client.Call`和`org.apache.axis.client.Service`等,这些都是调用WebService所必需的。 ```java import javax.xml.namespace.QName; ...

    org.apache.axis2.eclipse.service.plugin_1.7.8

    `org.apache.axis2.eclipse.service.plugin_1.7.8`是专门为Eclipse设计的一个插件,旨在简化在Eclipse中使用和管理Apache Axis2服务的过程。 这个插件的主要功能包括: 1. **Axis2服务创建**:它允许用户直接在...

    Java Axis 直接调用webservice 接口工具类

    Java Axis 直接调用webservice 接口工具类, 无需根据wsdl编译客户端,需要axis相关包,测试使用axis 1.4, 附demo引入axis包后直接可以测试;

    axis2发布webservice和调用axis2服务接口

    在IT行业中,Axis2是Apache软件基金会开发的一个用于构建Web服务和Web服务客户端的框架,主要基于Java语言。本文将详细讲解如何使用Axis2来发布Web服务以及如何生成客户端代码来调用这些服务。 首先,让我们了解...

    Java动态调用webService,axis2动态调用webService

    本文将深入探讨如何使用Axis2来动态地调用Web Service,并通过分析`WebServiceInvoker.java`这个文件来理解其实现原理。 1. **Java动态调用Web Service**: 在Java中,动态调用Web Service主要涉及到JAX-WS(Java ...

    axis2 调用webservice 例子

    &lt;groupId&gt;org.apache.axis2 &lt;artifactId&gt;axis2 &lt;version&gt;1.6.2 &lt;groupId&gt;org.apache.axis2 &lt;artifactId&gt;axis2-adb &lt;version&gt;1.6.2 &lt;groupId&gt;org.apache.axis2 ...

    java 通过axis调用天气预报的webservice

    标题中的“Java通过Axis调用天气预报的WebService”是指使用Java编程语言,通过Apache Axis库来访问和使用公开的天气预报Web服务。Apache Axis是一个开放源码的SOAP(简单对象访问协议)工具包,它允许开发者创建和...

    利用AXIS调用webservice所需JAR包

    在描述中提到的"利用AXIS,通过wsdl的url直接调用webservice接口时所需要的jar包",这些JAR文件主要包括以下组件: - **axis.jar**:这是AXIS的核心库,包含了处理SOAP消息、WSDL解析和生成Stub的主要类。 - **...

    axis 代码jar包

    Axis是Apache软件基金会开发的一个开放源代码的SOAP(简单对象访问协议)服务器和客户端实现,主要用于Web服务。本文将深入探讨Axis的相关知识点,特别是关于"axis-1.4 jar包"的内容。 一、Axis简介 Axis是Java...

Global site tag (gtag.js) - Google Analytics