How to generate a soap message Header using DII (Dynamic interfac e invocation)?

From: Oppedal Anita <anita.oppedal_at_TIETOENATOR.COM>
Date: Wed, 07 May 2003 16:44:41 +0200

I want to contact a webservice, that requires the following
soapmessage for input:


I am using DII, and have succeedes creating the body element
with this class:
package dynamic;

import javax.xml.rpc.Call;
import javax.xml.rpc.Service;
import javax.xml.rpc.JAXRPCException;
import javax.xml.namespace.QName;
import javax.xml.rpc.ServiceFactory;
import javax.xml.rpc.ParameterMode;

public class HelloClient {

    private static String endpoint =

    private static String
    private static String
    private static String

    private static String USERNAME="usernameValue";

private static String qnameService = "PasLink";
    private static String qnamePort = "PasLinkIF";

    private static String BODY_NAMESPACE_VALUE =

    private static String ENCODING_STYLE_PROPERTY =
    private static String NS_XSD =
    private static String URI_ENCODING =

    public static void main(String[] args) {
        try {
            ServiceFactory factory =
            Service service =
                factory.createService(new QName(qnameService));

            QName port = new QName(qnamePort);

            Call call = service.createCall(port);


                new Boolean(true));

            call.setProperty(Call.SOAPACTION_URI_PROPERTY, SOAP_ACTION);

            //Encoding settes til soap sin encoding
            call.setProperty(ENCODING_STYLE_PROPERTY, URI_ENCODING);
            call.setProperty(Call.USERNAME_PROPERTY, USERNAME);

            QName QNAME_TYPE_STRING = new QName(NS_XSD, "string");

            call.setOperationName(new QName(BODY_NAMESPACE_VALUE,
            call.addParameter("UserName", QNAME_TYPE_STRING,
            call.addParameter("PassWord", QNAME_TYPE_STRING,

            String[] params={"Usernamevalue","PaswordValue"};

            String result = (String)call.invoke(params);


        } catch (Exception ex) {

>>From this I am able to create this message:
POST /PasLink/AuthenticationWS/AuthenticationWS.asmx HTTP/1.1
Content-Type: text/xml; charset="utf-8"
Content-Length: 540
SOAPAction: ""
Authorization: Basic aW5mb214Om51bGw=
User-Agent: Java/1.4.1_02
Host: localhost:8090
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env=""
1:GetUserLogin xmlns:ans1=""><UserName

But unfortunealty I have not found out how to create an soap header element.
The answer I get from the server is:
HTTP/1.1 100 Continue
Server: Microsoft-IIS/5.0
Date: Wed, 07 May 2003 11:47:38 GMT

HTTP/1.1 500 Internal Server Error.
Server: Microsoft-IIS/5.0
Date: Wed, 07 May 2003 11:47:38 GMT
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Content-Length: 343

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="">
      <faultstring>Server did not find required RequestHeader SOAP header in
the message.</faultstring>

I really hope anybody Is able to help me about this!

Yours Sincerely

Anita Oppedal

I am very gratefull if somebody have good examples who explain the
differents, or can refer to good articles about this theme. Do you use
either JAX-RPC and JAXM to the same purpose, or do you combine them it some

Thank you.

yours sincerely

Anita Iren Oppedal