正常に動作する Web サービスへの Metro クライアントがあります。ただし、ラボ環境ではサービスにアクセスできないため、テスト用のモック サービスを作成しました。エンドポイントとその設定方法を理解するのに問題があります。
URL をクライアント コンストラクターに渡し、次のようにリクエスト コンテキストに設定します。
    // Set the service port URL
    BindingProvider bindingProvider = ((BindingProvider) port);
    Map<String, Object> context = bindingProvider.getRequestContext();
    context.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, serviceURL);
私のモック サービスでは、アプリケーションのリスト (http://myserver:80/MySoapService) の [Launch] リンクをクリックしたときに、Glassfish から提供された戦争の URL を使用しています。
コードは、提供された wsdl から生成されています。WebService インターフェイスは次のようになります。
@WebService(name = "My_Soap_Service", targetNamespace = "urn:My.DataEntityModel")
@XmlSeeAlso({
    ObjectFactory.class
})
public interface MySoapService {
    @WebMethod(operationName = "Ping", action = "urn:My.DataEntityModel/Ping")
    @WebResult(name = "PingResult", targetNamespace = "urn:My.DataEntityModel")
    @RequestWrapper(localName = "Ping", targetNamespace = "urn:My.DataEntityModel", className = "dataentitymodel.Ping")
    @ResponseWrapper(localName = "PingResponse", targetNamespace = "urn:My.DataEntityModel", className = "dataentitymodel.PingResponse")
    public String ping(
        @WebParam(name = "inputString", targetNamespace = "urn:My.DataEntityModel")
        String inputString);
    @WebMethod(operationName = "ProcessRecordResult", action = "urn:My.DataEntityModel/ProcessRecordResult")
    @WebResult(name = "ProcessRecordResultResult", targetNamespace = "urn:My.DataEntityModel")
    @RequestWrapper(localName = "ProcessRecordResult", targetNamespace = "urn:My.DataEntityModel", className = "dataentitymodel.ProcessRecordResult")
    @ResponseWrapper(localName = "ProcessRecordResultResponse", targetNamespace = "urn:My.DataEntityModel", className = "dataentitymodel.ProcessRecordResultResponse")
    public String ProcessRecordResult(
        @WebParam(name = "recordStatusXML", targetNamespace = "urn:My.DataEntityModel")
        String recordStatusXML);
    @WebMethod(operationName = "ProcessBatchResult", action = "urn:My.DataEntityModel/ProcessBatchResult")
    @WebResult(name = "ProcessBatchResultResult", targetNamespace = "urn:My.DataEntityModel")
    @RequestWrapper(localName = "ProcessBatchResult", targetNamespace = "urn:My.DataEntityModel", className = "dataentitymodel.ProcessBatchResult")
    @ResponseWrapper(localName = "ProcessBatchResultResponse", targetNamespace = "urn:My.DataEntityModel", className = "dataentitymodel.ProcessBatchResultResponse")
    public String processBatchResult(
        @WebParam(name = "batchStatusXML", targetNamespace = "urn:My.DataEntityModel")
        String batchStatusXML);
}
私の web.xml は次のようになります。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
<web-app>
    <listener>
        <listener-class>
            com.sun.xml.ws.transport.http.servlet.WSServletContextListener </listener-class>
    </listener>
    <servlet>
        <servlet-name>MySoapService</servlet-name>
        <servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>MySoapService</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>60</session-timeout>
    </session-config>
</web-app>
sun-jaxws.xml ファイルの設定に問題があります。最初は次のように見えました。
<?xml version="1.0" encoding="UTF-8"?>
<endpoints
        xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime"
        version="2.0">
    <endpoint
            name="MyService"
            implementation="my.package.MySoapServiceImpl"
            url-pattern="/"
            wsdl-location="WEB-INF/wsdl/MySoapService.wsdl"/>
</endpoints>
しかし、私のクライアントは、サービスを説明する「Web サービス」HTML ページを返しました。sun-jaxws.xml ファイルの実用的な情報/例を見つけることができませんでしたが、Web サービスの各メソッドにエンドポイントが必要であると考えました。そこで、次のように変更しました。
<?xml version="1.0" encoding="UTF-8"?>
<endpoints
        xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime"
        version="2.0">
    <endpoint
            name="Ping"
            implementation="my.package.MySoapServiceImpl"
            url-pattern="/ping"
            wsdl-location="WEB-INF/wsdl/MySoapService.wsdl"/>
    <endpoint
            name="ProcessRecord"
            implementation="my.package.MySoapServiceImpl"
            url-pattern="/processRecordResult"
            wsdl-location="WEB-INF/wsdl/MySoapService.wsdl"/>
    <endpoint
            name="ProcessBatch"
            implementation="my.package.MySoapServiceImpl"
            url-pattern="/processBatchResult"
            wsdl-location="WEB-INF/wsdl/MySoapService.wsdl"/>
</endpoints>
クライアントがサービスにアクセスしようとすると、404 エラーが発生します。
クライアントで間違った URL を使用しているのか、それともまったく別のものを使用しているのか、sun-jaxws.xml ファイルや web.xml ファイルを正しく設定していないのかどうかはわかりません。
誰かが私が間違っていることを教えてくれますか、および/またはこれを理解しやすい方法で説明するリソースを教えてくれますか?