私はこの問題を抱えています。Seam Frameworkを使用して、JBoss5上で実行されるWebサービスを作成しました。Webサービスには、「ログイン」と呼ばれる単一のメソッドがあります。Javaクライアントからサービスを利用する場合は正常に機能しますが、Visual FoxProクライアント(私の本当の必要性)から利用しようとすると、エラーメッセージが表示されます。
Error 1429 - OLE IDispatch exception code 0 from ?: Cannot find child element: username
JBossからのエラースタックトレース:
12:02:32,396 ERROR [SOAPFaultHelperJAXWS] SOAP request exception
org.jboss.ws.WSException: Cannot find child element: username
at org.jboss.ws.core.CommonSOAPBinding.getParameterFromMessage(CommonSOAPBinding.java:917)
at org.jboss.ws.core.CommonSOAPBinding.unbindRequestMessage(CommonSOAPBinding.java:361)
at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:197)
at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:474)
at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:295)
at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:205)
at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:131)
at org.jboss.wsf.common.servlet.AbstractEndpointServlet.service(AbstractEndpointServlet.java:85)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
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:235)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
私のWebサービスクラス:
@Name("ServiceName")
@WebService(name = "ServiceName", serviceName = "ServiceName")
@SOAPBinding(style = SOAPBinding.Style.RPC)
@Stateless
public class ServiceName implements ServiceNameRemote {
@WebMethod
@Override
public boolean login(@WebParam(name = "username") String username, @WebParam(name = "password") String password) {
// logic..
return result;
}
}
からのWSDLlocalhost:8080/app-app/ServiceName?wsdl
<definitions name="ServiceName"
targetNamespace="http://service.namespace/"
xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://service.namespace/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<types />
<message name="ServiceName_login">
<part name="username" type="xsd:string" />
<part name="password" type="xsd:string" />
</message>
<portType name="ServiceName">
<operation name="login" parameterOrder="username password">
<input message="tns:ServiceName_login" />
<output message="tns:ServiceName_loginResponse" />
</operation>
</portType>
<binding name="ServiceNameBinding" type="tns:ServiceName">
<soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="login">
<soap:operation soapAction="" />
<input>
<soap:body namespace="http://service.namespace/"
use="literal" />
</input>
<output>
<soap:body namespace="http://service.namespace/"
use="literal" />
</output>
</operation>
</binding>
<service name="ServiceName">
<port binding="tns:ServiceNameBinding" name="ServiceNamePort">
<soap:address
location="http://localhost:8080/app-app/ServiceName" />
</port>
</service>
</definitions>
クライアントコード(MS Soap Toolkit 3.0を使用):
LOCAL loServiceNamePort AS "XML Web Service"
* LOCAL loServiceNamePort AS "MSSOAP.SoapClient30"
* Do not remove or alter following line. It is used to support IntelliSense for your XML Web service.
*__VFPWSDef__: loServiceNamePort = http://localhost:8080/app-app/ServiceName?wsdl , ServiceName , ServiceNamePort
LOCAL loException, lcErrorMsg, loWSHandler
TRY
loWSHandler = NEWOBJECT("WSHandler",IIF(VERSION(2)=0,"",HOME()+"FFC\")+"_ws3client.vcx")
loServiceNamePort = loWSHandler.SetupClient("http://localhost:8080/app-app/ServiceName?wsdl", "ServiceName", "ServiceNamePort")
* Call your XML Web service here. ex: leResult = loServiceNamePort.SomeMethod()
MESSAGEBOX(loServiceNamePort.login("username", "password"))
CATCH TO loException
lcErrorMsg = "Error: "+TRANSFORM(loException.Errorno)+" - "+loException.Message
DO CASE
CASE VARTYPE(loServiceNamePort)#"O"
* Handle SOAP error connecting to web service
WAIT WINDOW "Error connecting to web service" NOWAIT
CASE !EMPTY(loServiceNamePort.FaultCode)
* Handle SOAP error calling method
lcErrorMsg = lcErrorMsg + CHR(13) + loServiceNamePort.Detail
WAIT WINDOW "SOAP error calling method" NOWAIT
OTHERWISE
* Handle other error
ENDCASE
* Use for debugging purposes
MESSAGEBOX(lcErrorMsg)
FINALLY
ENDTRY
クライアントコード(PocketSOAPを使用):
LOCAL loException, lcErrorMsg, loFactory, loProxy
TRY
loFactory = createObject("pocketsoap.Factory")
loProxy = loFactory.CreateProxy("http://localhost:8080/app-app/ServiceName?wsdl", "http://service.namespace/")
MESSAGEBOX(loProxy.login("username", "password"))
CATCH TO loException
lcErrorMsg = "Error: "+TRANSFORM(loException.Errorno)+" - "+loException.Message
DO CASE
CASE VARTYPE(loServiceNamePort)#"O"
* Handle SOAP error connecting to web service
WAIT WINDOW "Error connecting to web service" NOWAIT
CASE !EMPTY(loServiceNamePort.FaultCode)
* Handle SOAP error calling method
lcErrorMsg = lcErrorMsg + CHR(13) + loServiceNamePort.Detail
WAIT WINDOW "SOAP error calling method" NOWAIT
OTHERWISE
* Handle other error
ENDCASE
* Use for debugging purposes
MESSAGEBOX(lcErrorMsg)
FINALLY
ENDTRY
なぜこれが起こるのかについての説明を探していましたが、見つかりませんでした。グーグルで見つけたいくつかのことを試しました。@WebParamアノテーションに対応する値の名前空間属性を追加し、名前と名前空間の@WebResultアノテーションを追加し、SOAPバインディングをRPCからDocumentに変更しました。あなたがここで私に与えることができるどんな助けも本当にありがたいです。
編集:SOAPサービスを廃止し、現在はRESTサービスを使用しています。これは、ブリッジアプリケーションを必要とせずに、VisualFoxからより簡単に利用できることがわかりました。