I can't get anything out of the toString() result in your mail.
 
But here this is how to use the TCPMon application:
Your client should bind to the TCPMon. The TCPMon forwards the requests to your service. So if the service doesn't specify any port (=port 80, you are right) you have to set up TCPMon to use port 80. After that you choose another port (let's take 9090) for the communication between the client and the TCPMon.
 
In other words:
The TCPMon should listen at port 9090. Then set up the TargetHostname to http://service-machine.com  and the TargetPort to 80
 
I hope this will help
 
Matt 
 
 
 -----Original Message-----
From: Tom Leuntjens [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 11, 2002 9:17 AM
To: [EMAIL PROTECTED]
Subject: RE: Correct way to add Apache SOAP Header ?

Yep that's correct ..

 

 

 

Ive started the tcpmon ..

 

The service I'm connecting to from in my code , I don't define port so that must be 80 ...

 

I keep getting waiting for connection ...

 

I run my java code from command prompt ..

How important is the listen port ?

If I choose 80 I get JVM_bind error ..  (ive shutdown my server) .. it works ..

I keep getting waiting for connection ...

 

The toString() of the call (for my code at the time that doesn't work) gives this :

[Header=[Attributes={ Build="0" Revision="0" xmlns:Version="" Identification="SK
ARABEEPRO" Minor="0" Major="0"}] [HeaderEntries={}]] [methodName=Ping] [targetOb
jectURI=leftthisouttopostonforum] [encodingStyleURI=Co
nstants.NS_URI_SOAP_ENC] [SOAPContext=[Parts={}]] [Params={}]

 

 

 

 

 

 

 

 

 

 

-----Original Message-----
From: Wimmer, Matthias [mailto:[EMAIL PROTECTED]]
Sent:
Tuesday, June 11, 2002 3:01 PM
To: '[EMAIL PROTECTED]'
Subject: RE: Correct way to add Apache SOAP Header ?

 

Ok,

 

so if I am not completely mistaken, your message needs a header like the one you quoted, right? And which kind of header does your code produce? If you are not sure, try the TCPMonitor. You start it with:  

 

                 java org.apache.axis.utils.tcpmon

 

I think this tool is very useful.

 

Matt

-----Original Message-----
From: Tom Leuntjens [mailto:[EMAIL PROTECTED]]
Sent:
Tuesday, June 11, 2002 8:57 AM
To: [EMAIL PROTECTED]
Subject: RE: Correct way to add Apache SOAP Header ?

The problem is that I need to compose this little piece header ... and add it to the call (I think) ..

 

  <soap:Header>
    <Version Identification="SKARABEEPRO" Major="0" Minor="0" Build="0" Revision="0" xmlns="XXX" />
  </soap:Header>
 

 

I' don't really see how I need to do this with APACHE SOAP API

 

Code so far .....

 

import java.io.*;

import java.util.*;

import java.net.*;

import org.w3c.dom.*;

import org.apache.soap.util.xml.*;

import org.apache.soap.*;

import org.apache.soap.encoding.*;

import org.apache.soap.encoding.soapenc.*;

import org.apache.soap.rpc.*;

import org.apache.soap.transport.http.SOAPHTTPConnection;

 

public class testClient {

 

            public static void main(String[] args) throws Exception {

 

                        URL url = new URL ("http://xxx/dataswitch23.asmx");

                        String SOAPAction = "http://xxx/core23/Ping";

                        SOAPMappingRegistry smr = new SOAPMappingRegistry();

                        StringDeserializer sd = new StringDeserializer ();

                        smr.mapTypes (Constants.NS_URI_SOAP_ENC, new QName ("", "Result"), null, null, sd);

 

 

                        // create the transport and set parameters

                        SOAPHTTPConnection st = new SOAPHTTPConnection();

                        st.setUserName("xxxx");

                        st.setPassword("xxx");

 

                        // create the header

                        Header myHeader = new Header();

                        myHeader.declareNamespace("", " XXX ");

                        myHeader.setAttribute(new QName("", "Identification"), "SKARABEEPRO");

                        myHeader.setAttribute(new QName("", "Major"), "0");

                        myHeader.setAttribute(new QName("", "Minor"), "0");

                        myHeader.setAttribute(new QName("", "Revision"), "0");

                        myHeader.setAttribute(new QName("", "Build"), "0");

 

/*

                        System.out.println("\n------------------------------------------------\n");

                        System.out.println(myHeader.toString());

*/

 

 

                        // build the call.

                        Call call = new Call ();

                        call.setSOAPTransport(st);

                        call.setSOAPMappingRegistry (smr);

                        call.setTargetObjectURI ("http://xxx/service/dataswitch23.asmx");

                        call.setMethodName("Ping");

                        call.setEncodingStyleURI ("Constants.NS_URI_SOAP_ENC");

                        call.setHeader(myHeader);

 

 

/*

                        System.out.println("\n------------------------------------------------\n");

                        System.out.println(call.toString());

                        System.out.println("\n------------------------------------------------\n");

*/

 

                        Response resp = null;

                        try {

                          resp = call.invoke (url, SOAPAction);

                        }

                        catch (SOAPException e) {

                                    System.err.println("Caught SOAPException (" + e.getFaultCode () + "): " + e.getMessage ());

                                    return;

                        }

 

                        // check response

                        if (resp != null && !resp.generatedFault()) {

                           Parameter ret = resp.getReturnValue();

                          Object value = ret.getValue();

 

                          System.out.println ("Answer--> " + value);

                        }

                        else {

                                    Fault fault = resp.getFault ();

                                    System.err.println ("Generated fault: ");

                                    System.out.println (" Fault Code = " + fault.getFaultCode());

                                    System.out.println (" Fault String = " + fault.getFaultString());

                        }

            }

}

 

 

the error I keep getting ...

Server did not find required Version SOAP header in the message

 

 

 

-----Original Message-----
From: Wimmer, Matthias [mailto:[EMAIL PROTECTED]]
Sent:
Tuesday, June 11, 2002 2:42 PM
To: '[EMAIL PROTECTED]'
Subject: RE: Correct way to add Apache SOAP Header ?

 

Tom:

 

What is your problem? Doesn't it work? So below you will find an example I found:

 

        Element emailElem = doc.createElementNS( "http://any.namespace.com",  "EMail");
        emailElem.appendChild( ... );

        SOAPEnvelope reqEnv = new SOAPEnvelope();
        reqEnv.addHeader( new SOAPHeader(emailElem ));
        reqEnv.addBodyElement( ... );
       
        // Invoke the web service
        Call call = new Call( url );
        SOAPEnvelope respEnv = call.invoke(reqEnv);

I hope it works like this.

 

best regards

Matthias Wimmer

-----Original Message-----
From: Tom Leuntjens [mailto:[EMAIL PROTECTED]]
Sent:
Tuesday, June 11, 2002 7:01 AM
To: [EMAIL PROTECTED]
Subject: Correct way to add Apache SOAP Header ?

Hi,
So far im creating the call and i get this :
System.Web.Services.Protocols.SoapHeaderException: Server did not find required Version SOAP header in the message.
So I have been trying to add the header like this but to no avail ..

 

 

// create the header
Header myHeader = new Header();
myHeader.declareNamespace("Version", "");
 
myHeader.setAttribute(new QName("", "Identification"), "SKARABEEPRO");
 
myHeader.setAttribute(new QName("", "Major"), "0");
myHeader.setAttribute(new QName("", "Minor"), "0");
myHeader.setAttribute(new QName("", "Revision"), "0");
myHeader.setAttribute(new QName("", "Build"), "0");
 
//add the header to the call ...
call.setHeader(myHeader);


Can somebody can give me some more info on how to do this ? What is the correct way to add the header (details below)? Don't seem to find any info about it ...
Any help is appreciated ..
Thanx
Regards,
Tom

The service requires this call:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <Version Identification="SKARABEEPRO" Major="0" Minor="0" Build="0" Revision="0" xmlns="leftthisouttopost" />
  </soap:Header>
  <soap:Body>
    <Ping xmlns="leftthisouttopost" />
  </soap:Body>
</soap:Envelope>


The toString() of the call (for my code at the time that doesn't work) gives this :

[Header=[Attributes={ Build="0" Revision="0" xmlns:Version="" Identification="SK
ARABEEPRO" Minor="0" Major="0"}] [HeaderEntries={}]] [methodName=Ping] [targetOb
jectURI=leftthisouttopostonforum] [encodingStyleURI=Co
nstants.NS_URI_SOAP_ENC] [SOAPContext=[Parts={}]] [Params={}]

 

Reply via email to