如何分离已从特定端口部署的Web服务应用程序?

时间:2016-09-02 17:10:00

标签: java web-services soap endpoint

您好我在特定端口使用JAX-WS API部署了基于SOAP的Web服务应用程序 CalculatorRpcWSImpl ,使用Endpoint.publish(url, object)方法 7892

但是现在我想从该特定端口 7892 取消部署/分离此Web服务 CalculatorRpcWSImpl 。我怎么能这样做?

发布商类

public class CalculatoRpcWSPublisher {

public static void main(String[] args) {
    CalculatorRpcWS crw = new CalculatorRpcWSImpl();
    String url = "http://localhost:7892/ws/rpccalculator";

    Endpoint endpoint = Endpoint.publish(url, crw);

    if(endpoint.isPublished()){
        System.out.println("CalculatoRpcWS web services successfully deployed in server.");
    }else{
        endpoint.stop();
        System.out.println("Some error occur to deploye CalculatoRpcWS web services.");
    }
}

CalculatorRpcWS Web服务的WSDL XML文件:

<definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://rpc.jaxws.ws.sayan.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://rpc.jaxws.ws.sayan.com/" name="CalculatoRpcWSImplService">
<types/>
<message name="add">
<part name="arg0" type="xsd:string"/>
<part name="arg1" type="xsd:string"/>
</message>
<message name="addResponse">
<part name="return" type="xsd:string"/>
</message>
<portType name="CalculatoRpcWS">
<operation name="add" parameterOrder="arg0 arg1">
<input wsam:Action="http://rpc.jaxws.ws.sayan.com/CalculatoRpcWS/addRequest" message="tns:add"/>
<output wsam:Action="http://rpc.jaxws.ws.sayan.com/CalculatoRpcWS/addResponse" message="tns:addResponse"/>
</operation>
</portType>
<binding name="CalculatoRpcWSImplPortBinding" type="tns:CalculatoRpcWS">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/>
<operation name="add">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal" namespace="http://rpc.jaxws.ws.sayan.com/"/>
</input>
<output>
<soap:body use="literal" namespace="http://rpc.jaxws.ws.sayan.com/"/>
</output>
</operation>
</binding>
<service name="CalculatoRpcWSImplService">
<port name="CalculatoRpcWSImplPort" binding="tns:CalculatoRpcWSImplPortBinding">
<soap:address location="http://localhost:7892/ws/rpccalculator"/>
</port>
</service>
</definitions>

0 个答案:

没有答案