question

Upvotes
Accepted
1 0 0 1

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>
                        </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>
                        </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?

rkd-apirkdtoken
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

@jiangxianlin
Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query? If yes please click the 'Accept' text next to the reply. This will guide all community members who have a similar question. Otherwise please post again offering further insight into your question.
Thanks,
-AHS

@jiangxianlin
Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.
Thanks,
-AHS

1 Answer

· Write an Answer
Upvotes
Accepted
78.8k 250 52 74

@jiangxianlin

Please share the application code that uses spring webservice as SOAP client. To set SOAP headers, please refer to this thread on stack overflow.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.