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 5.0 MiB each and 10.0 MiB total.

1 Answer

Upvotes
Accepted
38.1k 71 35 53

@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 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea