这是一个很长的配置文件... 我正在从JBoss 4.0.5升级到4.2.3 我使用的系统有一个遗留的Web服务。它基于J2EE webservices 1.1。 它有一个SLSB(EJB2)作为端点。 WSDL文件指出了一个模式(XSD文件)文件,用于定义Web服务的参数。 并且有一个映射到模式的映射文件。
问题: 对于初学者来说,该服务适用于JBoss 4.0.5。 在4.2.3中,除了附件元素之外,它的工作完全正常,base64数据无法正确转换为字节数组。将其更改为字符串工作正常,因此拼写错误没有问题,它只是不会转换为字节数组。 从4.0.5升级到4.2.3时有没有人遇到过类似的问题?
如果我从通话中移除附件,它可以正常工作,但如果我有一个附件,如果失败了:
org.jboss.ws.WSException: org.jboss.ws.core.binding.BindingException: org.jboss.ws.core.jaxrpc.binding.jbossxb.UnmarshalException: Failed to
parse source: Failed to resolve target property type on org.jboss.xb.binding.sunday.unmarshalling.ElementBinding@1f1804d({http://foo/newsws/types}attachment, type={http://foo/newsws/types}AttachmentElementType)
at org.jboss.ws.core.soap.XMLContent.unmarshallObjectContents(XMLContent.java:250)
at org.jboss.ws.core.soap.XMLContent.transitionTo(XMLContent.java:97)
at org.jboss.ws.core.soap.SOAPContentElement.transitionTo(SOAPContentElement.java:141)
at org.jboss.ws.core.soap.SOAPBodyElementDoc.transitionTo(SOAPBodyElementDoc.java:85)
at org.jboss.ws.core.soap.SOAPContentElement.getObjectValue(SOAPContentElement.java:173)
at org.jboss.ws.core.EndpointInvocation.transformPayloadValue(EndpointInvocation.java:263)
at org.jboss.ws.core.EndpointInvocation.getRequestParamValue(EndpointInvocation.java:115)
at org.jboss.ws.core.EndpointInvocation.getRequestPayload(EndpointInvocation.java:135)
at org.jboss.ws.core.server.DelegatingInvocation.getArgs(DelegatingInvocation.java:82)
at org.jboss.wsf.container.jboss42.InvocationHandlerEJB21.getMBeanInvocation(InvocationHandlerEJB21.java:169)
at org.jboss.wsf.container.jboss42.InvocationHandlerEJB21.invoke(InvocationHandlerEJB21.java:144)
at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:221)
at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:466)
at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:284)
at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:201)
at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:134)
at org.jboss.wsf.stack.jbws.EndpointServlet.service(EndpointServlet.java:84)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:393)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.jboss.ws.core.binding.BindingException: org.jboss.ws.core.jaxrpc.binding.jbossxb.UnmarshalException: Failed to parse source:
Failed to resolve target property type on org.jboss.xb.binding.sunday.unmarshalling.ElementBinding@1369863({http://foo/newsws/t
ypes}attachment, type={http://foo/newsws/types}AttachmentElementType)
at org.jboss.ws.core.jaxrpc.binding.JBossXBDeserializer.deserialize(JBossXBDeserializer.java:111)
at org.jboss.ws.core.jaxrpc.binding.JBossXBDeserializer.deserialize(JBossXBDeserializer.java:62)
at org.jboss.ws.core.binding.DeserializerSupport.deserialize(DeserializerSupport.java:60)
at org.jboss.ws.core.soap.XMLContent.unmarshallObjectContents(XMLContent.java:180)
... 36 more
Caused by: org.jboss.ws.core.jaxrpc.binding.jbossxb.UnmarshalException: Failed to parse source: Failed to resolve target property type on or
g.jboss.xb.binding.sunday.unmarshalling.ElementBinding@1369863({http://foo/newsws/types}attachment, type={http://foo/newsws/types}AttachmentElementType)
at org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBUnmarshallerImpl.unmarshal(JBossXBUnmarshallerImpl.java:65)
at org.jboss.ws.core.jaxrpc.binding.JBossXBDeserializer.deserialize(JBossXBDeserializer.java:103)
... 39 more
Caused by: org.jboss.xb.binding.JBossXBException: Failed to parse source: Failed to resolve target property type on org.jboss.xb.binding.sun
day.unmarshalling.ElementBinding@1369863({http://foo/newsws/types}attachment, type={http://foo/newsws/types}Attach
mentElementType)
at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:179)
at org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:126)
at org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBUnmarshallerImpl.unmarshal(JBossXBUnmarshallerImpl.java:61)
... 40 more
Caused by: org.jboss.ws.WSException: Failed to resolve target property type on org.jboss.xb.binding.sunday.unmarshalling.ElementBinding@1369
863({http://foo/newsws/types}attachment, type={http://foo/newsws/types}AttachmentElementType)
at org.jboss.ws.extensions.xop.jaxrpc.JBossXBContentAdapter.beforeSetParent(JBossXBContentAdapter.java:115)
at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.endElement(SundayContentHandler.java:1005)
at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.endElement(SundayContentHandler.java:246)
at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$DelegatingContentHandler.endElement(SaxJBossXBParser.java:296)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.xinclude.XIncludeHandler.endElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:175)
... 42 more
这是webservices.xml
<webservice-description>
<webservice-description-name>FooService</webservice-description-name>
<wsdl-file>META-INF/wsdl/FooService.wsdl</wsdl-file>
<jaxrpc-mapping-file>META-INF/FooService-mapping.xml</jaxrpc-mapping-file>
<port-component>
<port-component-name>FooService</port-component-name>
<wsdl-port>FooServicePort</wsdl-port>
<service-endpoint-interface>com.foo.FooServiceEndpoint</service-endpoint-interface>
<service-impl-bean>
<ejb-link>FooServiceBean</ejb-link>
</service-impl-bean>
</port-component>
</webservice-description>
来自foo.xsd
<xs:complexType name="AttachmentElementType">
<xs:annotation>
<xs:documentation>Attachment data. When submitting, contains the attachment itself.</xs:documentation>
</xs:annotation>
<xs:simpleContent>
<xs:extension base="xs:base64Binary">
<xs:attribute name="filename" use="required">
<xs:annotation>
<xs:documentation>The filename of the attachment</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="href" type="xs:anyURI" use="optional">
<xs:annotation>
<xs:documentation>The URL from which the attachment can be downloaded. Not used when submitting news.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="mimeType" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>The MIME type of the attached file</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
来自FooService-mapping.xml
<java-xml-type-mapping>
<java-type>foo.MessageElementType</java-type>
<root-type-qname xmlns:typeNS='http://foo/newsws/types'>typeNS:MessageElementType</root-type-qname>
<qname-scope>complexType</qname-scope>
<variable-mapping>
<java-variable-name>category</java-variable-name>
<xml-element-name>category</xml-element-name>
</variable-mapping>
<variable-mapping>
<java-variable-name>type</java-variable-name>
<xml-element-name>type</xml-element-name>
</variable-mapping>
<variable-mapping>
<java-variable-name>headline</java-variable-name>
<xml-element-name>headline</xml-element-name>
</variable-mapping>
<variable-mapping>
<java-variable-name>body</java-variable-name>
<xml-element-name>body</xml-element-name>
</variable-mapping>
<variable-mapping>
<java-variable-name>attachment</java-variable-name>
<xml-element-name>attachment</xml-element-name>
</variable-mapping>
<variable-mapping>
<java-variable-name>field</java-variable-name>
<xml-element-name>field</xml-element-name>
</variable-mapping>
</java-xml-type-mapping>
Attachment.java看起来像这样:
public class AttachmentElementType
{
protected java.lang.String filename;
protected java.net.URI href;
protected java.lang.String mimeType;
protected byte[] _value;
public AttachmentElementType(){}
public AttachmentElementType(java.lang.String filename, java.net.URI href, java.lang.String mimeType, byte[] _value){
this.filename=filename;
this.href=href;
this.mimeType=mimeType;
this._value=_value;
}
public java.lang.String getFilename() { return filename ;}
public void setFilename(java.lang.String filename){ this.filename=filename; }
public java.net.URI getHref() { return href ;}
public void setHref(java.net.URI href){ this.href=href; }
public java.lang.String getMimeType() { return mimeType ;}
public void setMimeType(java.lang.String mimeType){ this.mimeType=mimeType; }
public byte[] get_value() { return _value ;}
public void set_value(byte[] _value){ this._value=_value; }
}
答案 0 :(得分:0)
通过将服务重新实现为JAX-WS注释的webservice,遵循相同的结构并使用相同的业务逻辑来解决这个问题。没有趣,但它奏效了。