質問

I am using wsimport to generate client web service code. (see part of wsdl code below).

Once code generation is done, I get empty TokenRequest class with no methods defined. On the other hand, TokenResponse class has several methods defined, few setters and few getters.

Given WSDL below, why is my TokenRequest class empty?

I expected it to had 4 setter methods for ClientKey, Password, UserKey and UserName. Now, I am not able to set these parameters and pass them to main Login method which receives this TokenRequest object.

I tried to create reference to this web service in .NET 4.0 and everything worked flawless. TokenRequest class had constructor that was receiving 4 paramters that I need.

Any idea what is wrong? Tomorrow I will try to do this using Axis2...

   <?xml version="1.0" encoding="utf-8"?>
    ...
                <wsdl:input name="TokenRequest">
                    **<soap12:header message="i0:TokenRequest_Headers" part="ClientKey" use="literal"/>
                    <soap12:header message="i0:TokenRequest_Headers" part="Password" use="literal"/>
                    <soap12:header message="i0:TokenRequest_Headers" part="UserKey" use="literal"/>
                    <soap12:header message="i0:TokenRequest_Headers" part="UserName" use="literal"/>
                    <soap12:body use="literal"/>**
                </wsdl:input>
                <wsdl:output name="TokenResponse">
                    <soap12:body use="literal"/>
                </wsdl:output>
     ...
役に立ちましたか?

解決

This secion "4.1.4. Mapping additional WSDL headers to method parameters" of link will explain why wsimport does not produce soap header properties you want. and there is a note in 4.1.4 section that says "Since JAX-WS RI 2.1.3, wsimport has a new option -XadditionalHeaders, this option will map such additional headers as method parameters." . So you should look at the documentation of library (Metro, Axis, CXF,......) and see if they have such feature.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top