有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java如何定义webservice端点url

我不熟悉webservice。我创建了一个具有以下WSDL定义的Web服务

 <wsdl:service name="InterfaceService">

    <wsdl:port name="InterfaceSOAP"
        binding="impl1InterfaceSOAP">
        <soap:address
            location="http://localhost:9080/MyWeb/services/MyInterface" />
    </wsdl:port>
 </wsdl:service>

发布Web服务时,Web服务在URLhttp://localhost:9080/MyWeb/InterfaceService而不是http://localhost:9080/MyWeb/services/MyInterfaceURL上可用。 我们如何更改发布Web服务的URL


共 (1) 个答案

  1. # 1 楼答案

    在websphereapplicationserver中,传统

    在web中使用自定义url模式。xml

    例如

    网络。xml

    <servlet id="...">
        <servlet-name>mypkg.MyInterface</servlet-name>
        <servlet-class>mypkg.MyInterface</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>mypkg.MyInterface</servlet-name>
        <url-pattern>/services/MyInterface</url-pattern> 
    </servlet-mapping>
    

    见正式文件here

    在WebSphere Liberty

    在ibm ws bnd中使用一个元素。xml

    例如

    ibmws-bnd。xml

    <?xml version="1.0" encoding="UTF-8"?>
    <webservices-bnd xmlns="http://websphere.ibm.com/xml/ns/javaee" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-ws-bnd_1_0.xsd" 
        version="1.0">
        <webservice-endpoint port-component-name="MyInterface" address="/services/MyInterface" />
    </webservices-bnd>
    

    见正式文件here