1

我正在研究IBM Sterling V 9.3。我已经使用知识中心提供的步骤在Jboss 4.2.3应用服务器上成功公开了一个服务作为JAX-WS Web 服务。EAR 文件部署成功,应用服务器启动正常。我可以看到为 Web 服务生成的 WSDL 文件。

当我尝试从soapUI 工具(版本 3.5.1)访问 WSDL时,响应消息中出现以下错误。我搜索了相同的内容,发现我们应该在 JBOSS_HOME\lib\endorsed 文件夹下有以下 jar:

• jboss-saaj.jar

• jboss-jaxws.jar

• jboss-jaxrpc.jar

• jaxb-api-2.1.9.jar

• xercesImpl.jar

• xalan.jar

• 序列化程序.jar

我已经添加了上面的罐子,但仍然得到同样的错误。如果需要,可以分享更多细节。请帮忙。

错误信息:

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
   <env:Header/>
   <env:Body>
      <env:Fault>
         <faultcode>env:Server</faultcode>
         <faultstring>java.lang.ClassCastException: org.jboss.ws.core.soap.TextImpl cannot be cast to javax.xml.soap.SOAPElement</faultstring>
      </env:Fault>
   </env:Body>
</env:Envelope>

WSDL 文件:

<?xml version="1.0" encoding="UTF-8"?>
<definitions name="SearsBeansService"
    targetNamespace="http://webservices.sears.com/"
    xmlns="http://schemas.xmlsoap.org/wsdl/"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:tns="http://webservices.sears.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <types>
        <xsd:schema>
            <xsd:import
                namespace="http://webservices.sears.com/documentation/SearsGetOrderListForWSCService/searsGetOrderListForWSCService/output" schemaLocation="SearsBeansService_schema1.xsd"/>
        </xsd:schema>
        <xsd:schema>
            <xsd:import
                namespace="http://webservices.sears.com/documentation/SearsGetOrderListForWSCService/searsGetOrderListForWSCService/input" schemaLocation="SearsBeansService_schema2.xsd"/>
        </xsd:schema>
        <xsd:schema>
            <xsd:import
                namespace="http://webservices.sears.com/documentation/SearsGetOrderDetailsForWSCService/searsGetOrderDetailsForWSCService/output" schemaLocation="SearsBeansService_schema3.xsd"/>
        </xsd:schema>
        <xsd:schema>
            <xsd:import
                namespace="http://webservices.sears.com/documentation/SearsGetOrderDetailsForWSCService/searsGetOrderDetailsForWSCService/input" schemaLocation="SearsBeansService_schema4.xsd"/>
        </xsd:schema>
        <xsd:schema>
            <xsd:import namespace="http://webservices.sears.com/" schemaLocation="SearsBeansService_schema5.xsd"/>
        </xsd:schema>
        <xsd:schema>
            <xsd:import
                namespace="http://www.sterlingcommerce.com/documentation/types" schemaLocation="yfctype.xsd"/>
        </xsd:schema>
    </types>
    <message name="searsGetOrderDetailsForWSCService">
        <part element="tns:searsGetOrderDetailsForWSCService" name="parameters"/>
    </message>
    <message name="searsGetOrderDetailsForWSCServiceResponse">
        <part element="tns:searsGetOrderDetailsForWSCServiceResponse" name="parameters"/>
    </message>
    <message name="XBeanWSException">
        <part element="tns:XBeanWSException" name="fault"/>
    </message>
    <message name="searsGetOrderListForWSCService">
        <part element="tns:searsGetOrderListForWSCService" name="parameters"/>
    </message>
    <message name="searsGetOrderListForWSCServiceResponse">
        <part element="tns:searsGetOrderListForWSCServiceResponse" name="parameters"/>
    </message>
    <portType name="SearsBeans">
        <operation name="searsGetOrderDetailsForWSCService">
            <input message="tns:searsGetOrderDetailsForWSCService"/>
            <output message="tns:searsGetOrderDetailsForWSCServiceResponse"/>
            <fault message="tns:XBeanWSException" name="XBeanWSException"/>
        </operation>
        <operation name="searsGetOrderListForWSCService">
            <input message="tns:searsGetOrderListForWSCService"/>
            <output message="tns:searsGetOrderListForWSCServiceResponse"/>
            <fault message="tns:XBeanWSException" name="XBeanWSException"/>
        </operation>
    </portType>
    <binding name="SearsBeansPortBinding" type="tns:SearsBeans">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <operation name="searsGetOrderDetailsForWSCService">
            <soap:operation soapAction=""/>
            <input>
                <soap:body use="literal"/>
            </input>
            <output>
                <soap:body use="literal"/>
            </output>
            <fault name="XBeanWSException">
                <soap:fault name="XBeanWSException" use="literal"/>
            </fault>
        </operation>
        <operation name="searsGetOrderListForWSCService">
            <soap:operation soapAction=""/>
            <input>
                <soap:body use="literal"/>
            </input>
            <output>
                <soap:body use="literal"/>
            </output>
            <fault name="XBeanWSException">
                <soap:fault name="XBeanWSException" use="literal"/>
            </fault>
        </operation>
    </binding>
    <service name="SearsBeansService">
        <port binding="tns:SearsBeansPortBinding" name="SearsBeansPort">
            <soap:address location="REPLACE_WITH_ACTUAL_URL"/>
        </port>
    </service>
</definitions>
4

2 回答 2

2

我能够解决这个问题。我必须从请求中删除所有空格、评论和问号(?)(如果有的话)。

之后它工作正常。我认为,由于请求中的空格,soapUI 将其视为某种请求元素/值,并且无法转换为 SOAPElement。

希望这对其他人有帮助!

于 2015-02-06T13:09:38.153 回答
1

在请求属性下,将“Strip whitespaces”设置为 true。这必须为每个新请求完成。我没有找到默认设置 true 的方法。问号是必须在您的请求中提供的参数的占位符。

于 2015-07-30T12:51:26.837 回答