JAX-RPC:获取错误" org.xml.sax.SAXException:WSWS3047E:错误:无法反序列化元素"

时间:2014-11-28 08:32:27

标签: web-services xsd wsdl websphere-7 jax-rpc

在尝试修改现有的wsdl并更改操作的请求类型和响应类型时,我得到以下内容。

我遵循的流程是: 1.修改xsd 2.生成Java Bean Skeleton(无法在多处引用时更改它)

尝试修复: 1.提到多篇文章并将WSDL更改为elementFormDefault ="不合格"并重新生成支持文件。 我试图设置xmlns =""禁用该字段的命名空间。

WSDL(仅修改已修改的操作,原始wswdl有大约52个操作)

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="ABCDEF" targetNamespace="http://managemyxyz.services.abc.def/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://managemyabc.services.abc.def/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsd1="http://cat.abc.def/ABC/schema/">

    <wsdl:types>
    <xsd:schema targetNamespace="http://manageabc.services.abc.def/">
      <xsd:complexType name="NewType"/>
    </xsd:schema>
        <xsd:schema>
            <xsd:import namespace="http://cat.abc.def/ABC/schema/" schemaLocation="xsd/ABC.xsd">
            </xsd:import>
    </xsd:schema>

  <wsdl:message name="insertABCRequest">
    <wsdl:part name="insertABCRequest" type="xsd1:InsertABCItemRequestType"/>
  </wsdl:message>
  <wsdl:message name="insertABCItemResponse">
    <wsdl:part name="insertABCItemResponse" type="xsd1:InsertABCItemResponseType"/>
  </wsdl:message>
  <wsdl:portType name="ABCDEF">
    <wsdl:operation name="insertABC">
        <wsdl:input message="tns:insertABCItemRequest1"/>
        <wsdl:output message="tns:insertABCItemResponse1"/>
    </wsdl:operation>
  </wsdl:portType>
<wsdl:binding name="ABCSOAP" type="tns:ABC">
        <wsdl:operation name="insertABC">

    <soap:operation soapAction="http://manageabc.services.abc.def/insertABC"/>
    <wsdl:input>

        <soap:body use="literal"/>
    </wsdl:input>
    <wsdl:output>

        <soap:body use="literal"/>
    </wsdl:output>
</wsdl:operation>
</wsdl:binding>
 <wsdl:service name="ABC">
<wsdl:port binding="tns:ABCSOAP" name="ABCSOAP">
  <soap:address location="http://localhost:10039/.modulename.war/services/ABCSOAP"/>
</wsdl:port>

    

ABC.xsd

<element name="InsertABCRequest" type="Q1:InsertABCItemRequestType">
</element>

<complexType name="InsertABCItemRequestType">
    <sequence>
        <element name="abcdId" type="int"/>
        <element name="abcdCode" type="string"/>
        <element name="abcNumber" type="string"/>
    </sequence>
</complexType>
<element name="InsertABCItemResponse" type="Q1:InsertABCItemResponseType">
</element>

<complexType name="insertABCItemResponse">
    <sequence>
        <element name="responseHeader" type="Q1:ResponseCodeType"/>
    </sequence>
</complexType>

例外:

[11/28/14 13:21:20:240 IST] 000000af WebServicesSe E com.ibm.ws.webservices.engine.transport.http.WebServicesServlet doPost WSWS3227E:  Error: Exception:
                         WebServicesFault



faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
 faultString: org.xml.sax.SAXException: WSWS3047E: Error: Cannot deserialize element fieldName of bean com.abc.xyz.abc.InsertABCRequestType. 
Child element fieldName does not belong in namespace . 
Most likely, a third party web services platform has sent an incorrect SOAP message. Message being parsed: 
 faultActor: null
 faultDetail: 

org.xml.sax.SAXException: WSWS3047E: Error: Cannot deserialize element fieldName of bean com.abc.xyz.abc.InsertABCRequestType.
Child element InsertABCRequestType does not belong in namespace . 
Most likely, a third party web services platform has sent an incorrect SOAP message. Message being parsed: 
    at com.ibm.ws.webservices.engine.WebServicesFault.makeFault(WebServicesFault.java:300)
    at com.ibm.ws.webservices.engine.SOAPPart._getSOAPEnvelope(SOAPPart.java:1090)
    at com.ibm.ws.webservices.engine.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:628)
    at com.ibm.ws.webservices.engine.SOAPPart.getEnvelope(SOAPPart.java:656)
    at com.ibm.ws.webservices.engine.handlers.jaxrpc.JAXRPCHandlerChain.handleRequest(JAXRPCHandlerChain.java:301)
    at com.ibm.ws.webservices.engine.handlers.jaxrpc.JAXRPCHandler.invokeServerRequestHandler(JAXRPCHandler.java:516)
    at com.ibm.ws.webservices.engine.handlers.jaxrpc.JAXRPCHandler$1.invoke(JAXRPCHandler.java:381)
    at com.ibm.ws.webservices.engine.PivotHandlerWrapper.invoke(PivotHandlerWrapper.java:225)
    at com.ibm.ws.webservices.engine.WebServicesEngine.invoke(WebServicesEngine.java:336)
    at com.ibm.ws.webservices.engine.transport.http.WebServicesServlet.doPost(WebServicesServlet.java:1246)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:738)
    at com.ibm.ws.webservices.engine.transport.http.WebServicesServletBase.service(WebServicesServletBase.java:344)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)

环境详情:

服务器:IBM WAS 7.0.0.31 IDE:IBM RAD 8.5

如果需要任何其他信息,请告诉我。

1 个答案:

答案 0 :(得分:1)

@BK Elizabeth - 谢谢你的回复。根据当前的实现,wsdl用于使用自顶向下方法生成java bean,而不是您在评论中引用的自下而上方法(毫无疑问这是一种更好的方法)。

真正的问题是生成的bean作为共享库在容器级别添加,因为bean的对象在多个模块之间传递。所以即使我在模块级更新bean,但实际上已经加载了以前版本的服务bean。在更新共享库时,我的更改开始反映并出现错误&#34; WSWS3047E:错误:无法反序列化元素&#34;得到解决&#34;。


对于&#34; WSWS3047E:错误:无法反序列化元素&#34;可以参考下面提到的错误链接,虽然我的问题有点不同。

http://www-01.ibm.com/support/docview.wss?uid=swg21220377