How to add Authorizaiton param to SOAP header?

I use maven-jaxb2-plugin to import WSDL, and use spring webservice as SOAP client.

<plugins>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.12.3</version>
<executions>
<execution>
<id>quotelists</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schemaLanguage>WSDL</schemaLanguage>
<generatePackage>quotelists.wsdl</generatePackage>
<schemas>
<schema>
<url>http://api.trkd.thomsonreuters.com/schemas/QuoteLists/wsdl/QuoteLists_1_HttpAndRKDToken.wsdl</url&gt;
</schema>
</schemas>
</configuration>
</execution>
<execution>
<id>token</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schemaLanguage>WSDL</schemaLanguage>
<generatePackage>token.wsdl</generatePackage>
<schemas>
<schema>
<url>http://api.rkd.reuters.com/schemas/TokenManagement/wsdl/TokenManagement_1_HttpsAndAnonymous.wsdl</url&gt;
</schema>
</schemas>
</configuration>
</execution>
</executions>
</plugin>
</plugins>

Then, I can get the service token.

But while I am trying to get Impersonal Token, an Exception name 'org.springframework.ws.soap.client.SoapFaultClientException: Object reference not set to an instance of an object.' is always thrown. I guess it is because I don't add Authorizaiton param to SOAP header.

So, I want to know how I can add Authorization information to Header?

Tagged:

Best Answer