Håkon T Sønderland wrote:

I am trying to use Axis to create a WS client consuming an
existing web service.

I've read all the newbie tutorial I could find, but the all seem
to be on the "hello world" level and think I understand what they
do.  But, trying to this with the web service I need, I get very
confused.

I'm using Axis 1.2.1 and Java 1.4.

I generate the client code using WSDL2Java such:

java org.apache.axis.wsdl.WSDL2Java -t -s \ "https://www.creditinform.biz/CreditInform.StandardWebservice.WS2005207/InfoXML.asmx?wsdl";

I now get among the stuff here a class called Header, which contains
username, password etc.

I think this should be used for setting up the username etc.  But how?

I generated the JUnit test class (-t parameter) hoping it would give me
a clue as to how to use the Header class, but it does not reference it
at all.  Needless to say none of the tutorial have anything like this.


OK, noone wanted to answer this so here is what I've found so far.

The Axis FAQ says:

"How do I set a header when using WSDL2Java stubs?

There are two styles of headers, explicit and implicit. Explicit headers are defined in the WSDL of the service. The WSDL2Java generation tool will recognize these headers in most cases and emit stub class methods that include the headers as arguments to the methods.

In other cases, you may want to set headers that are not explicitly called out in the WSDL. For instance, you want to do some custom processing in a handler or add security. In this case you can add
headers to request before you invoke the stub method."

What happens here is that the WSDL has information on the header, thus:

      <s:element name="Header" type="tns:Header"/>
      <s:complexType name="Header">
        <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="UserName" type="s:string"/> <s:element minOccurs="0" maxOccurs="1" name="Password" type="s:string"/> <s:element minOccurs="0" maxOccurs="1" name="SubUser" type="s:string"/> <s:element minOccurs="0" maxOccurs="1" name="CustomerId" type="s:string"/> <s:element minOccurs="0" maxOccurs="1" name="Version" type="s:string"/>
        </s:sequence>
      </s:complexType>
      </s:element>

this is referenced later:

  <wsdl:message name="ReportPersonSoapIn">
    <wsdl:part name="parameters" element="tns:ReportPerson"/>
  </wsdl:message>
  <wsdl:message name="ReportPersonSoapOut">
    <wsdl:part name="parameters" element="tns:ReportPersonResponse"/>
  </wsdl:message>
  <wsdl:message name="ReportPersonHeader">
    <wsdl:part name="Header" element="tns:Header"/>
  </wsdl:message>

However WSDL2Java does not "emit stub class methods that include the
headers as arguments to the methods" as the FAQ suggests.

Question: Is there anything wrong with the WSDL?
(the WSDL validates btw)

Does it help if I say pretty please?

Håkon

Reply via email to