我正在尝试在这里使用另一家公司提供的SOAP Web服务。 他们向我们发送了.WSDF文件和所有需要的.XSD文件。所以,我使用:
生成了所有Java类<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<wsdlDirectory>src/main/resources</wsdlDirectory>
<wsdlFiles>
<wsdlFile>compass/tran.wsdl</wsdlFile>
</wsdlFiles>
<wsdlUrls>
<wsdlUrl>src/main/resources/compass/tran.wsdl</wsdlUrl>
</wsdlUrls>
<sourceDestDir>target/generated-sources/compass</sourceDestDir>
<vmArgs>
<vmArg>-Djavax.xml.accessExternalSchema=all</vmArg>
</vmArgs>
</configuration>
<executions>
<execution>
<goals>
<goal>wsimport</goal>
</goals>
<id>generate-reports-ws-code</id>
<phase>generate-sources</phase>
</execution>
</executions>
</plugin>
我生成的与Web服务服务器连接的类具有以下方法:
@WebEndpoint(name = "tran")
public Tran getTran() {
return super.getPort(new QName("http://schemas.tranzaxis.com/tran.wsdl", "tran"), Tran.class);
}
返回具有所有公开方法的接口。
然后,我尝试在我的REST服务中执行此操作:
private Tran compassProxy;
....
compassProxy = new Tran_Service().getTran(); <Here comes the error!!>
invoke = compassProxy.tran(invoke);
所以,当我运行代码时,我从服务器获得一个异常,告诉我发生了“null之后意外的文件结束” 我在猜测它还在连接它时期待这个请求。
如果我在SoapUI中进行相同的调用,它可以完美地运行。
更新 以下是我从服务器获得的异常:
Unhandled exception in service "http://schemas.tranzaxis.com/tran.wsdl"
request processing:
org.radixware.kernel.server.exceptions.ArteSocketException: Can't receive
request from /10.45.0.62:50167 : java.io.IOException: Can't parse message:
Parse exception: org.apache.xmlbeans.XmlException: error: Unexpected end of
file after null
at org.radixware.kernel.server.instance.arte.ArteProcessor.recvSoapRequest(ArteProcessor.java:777)
at org.radixware.kernel.server.arte.services.Service.process(Service.java:97)
at org.radixware.kernel.server.arte.Arte.processServiceRequest(Arte.java:487)
at org.radixware.kernel.server.instance.arte.ArteProcessor.run(ArteProcessor.java:370)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.radixware.kernel.common.soap.ProcessException:
java.io.IOException: Can't parse message:
Parse exception: org.apache.xmlbeans.XmlException: error: Unexpected end of file after null
at org.radixware.kernel.common.soap.DefaultServerSoapMessageProcessor.unwrapRequest(DefaultServerSoapMessageProcessor.java:38)
at org.radixware.kernel.server.instance.arte.ArteProcessor.recvSoapRequest(ArteProcessor.java:759)
... 4 more
Caused by: java.io.IOException: Can't parse message:
Parse exception: org.apache.xmlbeans.XmlException: error: Unexpected end of file after null
at org.radixware.kernel.common.utils.SoapFormatter.parseSoapEnvelope(SoapFormatter.java:116)
at org.radixware.kernel.common.utils.SoapFormatter.parseBody(SoapFormatter.java:79)
at org.radixware.kernel.common.utils.SoapFormatter.parseSoapRequest(SoapFormatter.java:127)
at org.radixware.kernel.common.soap.DefaultServerSoapMessageProcessor.unwrapRequest(DefaultServerSoapMessageProcessor.java:36)
... 5 more
Caused by: org.apache.xmlbeans.XmlException: error: Unexpected end of file after null
at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3486)
at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1276)
at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1250)
at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:345)
at org.xmlsoap.schemas.soap.envelope.EnvelopeDocument$Factory.parse(EnvelopeDocument.java:76)
at org.radixware.kernel.common.utils.SoapFormatter.parseSoapEnvelope(SoapFormatter.java:103)
... 8 more
Caused by: org.xml.sax.SAXParseException; systemId: file:; lineNumber: 1; columnNumber: 1; Unexpected end of file after null
at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.reportFatalError(Piccolo.java:1038)
at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.parse(Piccolo.java:723)
at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3454)
... 13 more
有谁知道如何修复它?我在这里使用Spring框架,但这不是强制性的。我可以把它改成它的作用。
提前致谢。