我有一个正在运行的JAX-WS webservice,它已经有一些工作端点。现在我遇到以下问题:试图找出为什么这两个SOAP请求之一不起作用(java.lang.IllegalArgumentException)
我在这里有两个不同的SOAP请求,我不明白为什么第一个工作,但第二个没有。
请求中唯一明显的区别是第一个在<Envelope>
标记中指定一个名称空间,而第二个在调用方法<getMoldDataHistory>
时指定它。
SOAP请求1 - 无法正常工作(命名空间是在该方法调用中指定)
<s:Envelope
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
>
<s:Body
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
<getMoldDataHistory
xmlns="http://history.production.soap.webservices.product.company.at/">
<machineId>92623-15853588</machineId>
<start>0</start>
<end>0</end>
</getMoldDataHistory>
</s:Body>
</s:Envelope>
SOAP请求2 - 工作(命名空间在<Envelope>
标签指定)
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:his="http://history.production.soap.webservices.product.company.at/">
<soapenv:Header/>
<soapenv:Body>
<his:getMoldDataHistory>
<machineId>92623-15853588</machineId>
<start>0</start>
<end>0</end>
</his:getMoldDataHistory>
</soapenv:Body>
</soapenv:Envelope>
我在制作第一个(不工作)请求时收到的SOAP错误消息。
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<S:Fault xmlns:ns4="http://www.w3.org/2003/05/soap-envelope">
<faultcode>S:Server</faultcode>
<faultstring>java.lang.IllegalArgumentException</faultstring>
</S:Fault>
</S:Body>
</S:Envelope>
接收第一SOAP请求时从服务器抛出的异常的堆栈跟踪。
java.lang.IllegalArgumentException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.reflect.misc.Trampoline.invoke(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.reflect.misc.MethodUtil.invoke(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.xml.internal.ws.api.server.MethodUtil.invoke(Unknown Source)
at com.sun.xml.internal.ws.api.server.InstanceResolver$1.invoke(Unknown Source)
at com.sun.xml.internal.ws.server.InvokerTube$2.invoke(Unknown Source)
at com.sun.xml.internal.ws.server.sei.EndpointMethodHandler.invoke(Unknown Source)
at com.sun.xml.internal.ws.server.sei.SEIInvokerTube.processRequest(Unknown Source)
at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Unknown Source)
at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Unknown Source)
at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Unknown Source)
at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Unknown Source)
at com.sun.xml.internal.ws.server.WSEndpointImpl$2.process(Unknown Source)
at com.sun.xml.internal.ws.transport.http.HttpAdapter$HttpToolkit.handle(Unknown Source)
at com.sun.xml.internal.ws.transport.http.HttpAdapter.handle(Unknown Source)
at com.sun.xml.internal.ws.transport.http.server.WSHttpHandler.handleExchange(Unknown Source)
at com.sun.xml.internal.ws.transport.http.server.WSHttpHandler.handle(Unknown Source)
at com.sun.net.httpserver.Filter$Chain.doFilter(Unknown Source)
at sun.net.httpserver.AuthFilter.doFilter(Unknown Source)
at com.sun.net.httpserver.Filter$Chain.doFilter(Unknown Source)
at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(Unknown Source)
at com.sun.net.httpserver.Filter$Chain.doFilter(Unknown Source)
at sun.net.httpserver.ServerImpl$Exchange.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
所以我基本上是试图弄清楚为什么第一个请求是不是尽管它是一个有效的SOAP请求工作。我需要在我的服务器上配置什么来允许这样的请求吗?
编辑:
做一些更多的测试,我发现,命名空间声明的位置并不重要,如果我调用该方法具有0参数后。一旦需要参数,它将停止工作。
编辑2:
现在我stumpled在this thread here。我有同样的问题。发出请求的我的C#客户端不使用方法TAG中的名称空间。我添加它后,它的作品。
我该如何告诉JAX-WS来处理这个问题。
不起作用:
<getMoldDataHistory xmlns="http://history.production.soap.webservices.product.company.at/">
作品:
<his:getMoldDataHistory xmlns:his="http://history.production.soap.webservices.product.company.at/">
非常感谢您指出这一点。我没有意识到这一点! – Markus