2011-01-20 8 views
2

JAX-WS WebServiceを開発していますが、現在はカスタムのBindingという名前を定義する必要があります。JAX-WSのバインディング名を定義する

例えば:ポート名前がバインディング名は、デフォルトでMyJAXServiceBindingになるだろうMyJAXServiceある場合。私が欲しかったのはのバインドの名前がMyJAXServiceのようなものであることでした。

@WebService(serviceName = "MyJAXService", portName = "MyJAXService", endpointInterface = "com.test.MyJAXService", targetNamespace = "http://test.local/") 

答えて

4

私はあなたがWSDLのアプローチにJavaを使用していると仮定はそう、あなたの成果物からWSDLを生成する次のように

私のWebサービスが定義されて@WebServiceアノテーションを持っています。

@WebService(name = "MySoapBinding", targetNamespace = "http://mynamespace") 
public interface MySoapBinding { 
    ... 
} 

と実装:

生成

<?xml version="1.0" encoding="utf-8"?> 
<definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns="http://mynamespace" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://mynamespace"> 
    ... 
    <portType name="MySoapBinding"> 
    <operation name="MyOperation"> 
     ... 
    </operation> 
    </portType> 
    <binding name="MySoapBinding" type="ns:MySoapBinding"> 
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> 
    <operation name="MyOperation"> 
     ... 
    </operation> 
    </binding> 
    <service name="MyService"> 
    <port name="MySoapBinding" binding="ns:MySoapBinding"> 
     <soap:address location="http://localhost:8080/MyService"/> 
    </port> 
    </service> 
</definitions> 

アーチファクトは、インタフェースである:

Iは、通常のようにWSDLのために、Javaへの他のアプローチは、WSDLを使用して

@WebService(name = "MySoapBinding", targetNamespace = "http://mynamespace", endpointInterface = "my.package.MySoapBinding", serviceName = "MyService", portName = "MySoapBinding") 
public class MySoapBindingImpl 
    implements MySoapBinding 
{ 
} 

私は、WebサービスのインターフェイスとWSDLのジェネレータに名前を付けることができますatedはその名前をバインドという名前で使用する必要があります。

0

あなたが好きなWDSLを作成し、wsdl2javaを実行し、生成されたコードにどのsn @ ilsが出現しているかを確認し、使用してください。

関連する問題