Davanum,

This is probably more than what you wanted but here is a small program that
contains the offense ;)

<Code Begin ------------------------------------------->

//
// XMethods sample client for the Barnes and Noble Pricecheck service
//

import java.io.*;
import java.net.*;
import java.util.*;
import org.apache.axis.Message ;
import org.apache.axis.server.AxisServer;
import org.apache.axis.MessageContext ;
import org.apache.axis.Constants;
import org.apache.axis.transport.http.HTTPSender ;
import org.apache.axis.transport.http.HTTPConstants;

class SOAPSender
{
        HTTPSender m_sender ;
        AxisServer m_axis ;

        
//-------------------------------------------------------------------
        //
        
//-------------------------------------------------------------------
        SOAPSender()
        {
                m_sender        =       new HTTPSender() ;
                m_axis  =       new AxisServer() ;
        }
        
//-------------------------------------------------------------------
        // Send the data to setvice
        
//-------------------------------------------------------------------
        void sendData(String soapEnv, String url, boolean b100Continue)
        {
                Message responseMsg ;
                MessageContext ctx ;
                Hashtable ht ;
                System.out.println("Sending to \t\t- "+url) ;
                System.out.println("Message    \t\t - "+soapEnv) ;
            //
            // Create a new message context and a sender
            //
                ctx=new MessageContext(m_axis) ;
        //
            // Set the continue flag
            //
        if(b100Continue){
                        ht= new Hashtable() ;
                        ht.put(HTTPConstants.HEADER_EXPECT,
                   HTTPConstants.HEADER_EXPECT_100_Continue) ;
                        ctx.setProperty(HTTPConstants.REQUEST_HEADERS,ht) ;
        }
            //
            // Default to http 1.1
            //
            ctx.setProperty(MessageContext.HTTP_TRANSPORT_VERSION,
                        HTTPConstants.HEADER_PROTOCOL_V11) ;
                //
                // Create context
                //
                ctx.setRequestMessage(new Message(soapEnv));
                ctx.setProperty(MessageContext.TRANS_URL,url);
                //
                // Do it man
                //
        try {
            m_sender.invoke(ctx) ;
            //
            // Display the result
            //
            responseMsg=ctx.getResponseMessage() ;
            System.out.println("Got \t\t-
"+responseMsg.getSOAPPartAsString()) ;
        }
        catch (Exception e)
        {
            System.out.println("Exception - " + e.getMessage()) ;
        }
        }
        
//-------------------------------------------------------------------
        // Working example
        
//-------------------------------------------------------------------
        public void goodRequest()
        {
                String isbn ="1861007159";
        String url= "http://services.xmethods.com:80/soap/servlet/rpcrouter";
;
                String soapEnv = "<SOAP-ENV:Envelope xmlns:SOAP-ENV="+
        "\"http://schemas.xmlsoap.org/soap/envelope/\""; +
            "xmlns:xsi=\"http://www.w3.org/1999/XMLSchema-instance\""+
        "xmlns:xsd=\"http://www.w3.org/1999/XMLSchema\";>"+
            "<SOAP-ENV:Body><ns1:getPrice
xmlns:ns1=\"urn:xmethods-BNPriceCheck\""+
        "
SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\";>"+
                "<isbn xsi:type=\"xsd:string\">"+isbn+"</isbn>"+
            "</ns1:getPrice></SOAP-ENV:Body></SOAP-ENV:Envelope>" ;
                sendData(soapEnv,url,false) ;
        }

        
//-------------------------------------------------------------------
        // Bad request
        
//-------------------------------------------------------------------
        public void badRequest ()
        {
                String
url="http://ntg.webs.innerhost.com/WebEvents/events.asmx"; ;
                String  soapEnv ="<SOAP-ENV:Envelope xmlns:SOAP-ENV=\""+
        "http://schemas.xmlsoap.org/soap/envelope/\""+
 
"xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\""+
        "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\";
xmlns:xsd=\""+
        "http://www.w3.org/2001/XMLSchema\";><SOAP-ENV:Body><m:RegisterUser
"+
        "xmlns:m=\"http://ntg.webs.innerhost.com/webevents/\";>"+
        
"<m:MailBox>[EMAIL PROTECTED]</m:MailBox></m:RegisterUser>"+
        "</SOAP-ENV:Body></SOAP-ENV:Envelope>" ;
                sendData(soapEnv,url,false) ;
        }
        
//-------------------------------------------------------------------
        // Horrible request
        
//-------------------------------------------------------------------
        public void horribleRequest ()
        {
                String
url="http://ntg.webs.innerhost.com/WebEvents/events.asmx"; ;
        String  soapEnv ="<SOAP-ENV:Envelope xmlns:SOAP-ENV=\""+
        "http://schemas.xmlsoap.org/soap/envelope/\""+
 
"xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\""+
        "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\";
xmlns:xsd=\""+
        "http://www.w3.org/2001/XMLSchema\";><SOAP-ENV:Body><m:RegisterUser
"+
        "xmlns:m=\"http://ntg.webs.innerhost.com/webevents/\";>"+
        
"<m:MailBox>[EMAIL PROTECTED]</m:MailBox></m:RegisterUser>"+
        "</SOAP-ENV:Body></SOAP-ENV:Envelope>" ;
                sendData(soapEnv,url,true) ;
        }
}

public class BNClient {
// Driver to illustrate the invocation of the service
// This sample retrieves the price of the book "Understanding SOAP"

  public static void main(String[] args)
  {
        try {
        SOAPSender ss = new SOAPSender() ;
        //
        // Valid SOAP request
        //
        ss.goodRequest();
        //
        // This one generates an error
        //
        ss.badRequest();
        //
        // Happy waiting!
        //
        ss.horribleRequest();
       }
        catch (Exception e) {e.printStackTrace();}
  }
}
<Code End ------------------------------------------->

-----Original Message-----
From: Davanum Srinivas [mailto:[EMAIL PROTECTED]] 
Sent: Monday, December 09, 2002 7:12 PM
To: '[EMAIL PROTECTED]'
Subject: Re: HTTP 100 Continue


Is it possible to post the "offending" code fragment? and details about the
server? (verastream?)

Thanks,
dims

--- Bhushan Khanal <[EMAIL PROTECTED]> wrote:
> Davanum,
> 
> I am using the 1.0 version of Axis on the client side. I am not using Axis
> in the most conventional way but I suspect that this might be a general
> problem. In particular, I am using just the HTTPSender class to create and
> receive a web service call.
> 
> I also noticed that there might be a bug in the HttpSender implementation.
> Line 465 shows that the code waits for the http status before sending any
> http headers to the server.
> 
> Thanks,
> Bhushan
> 


=====
Davanum Srinivas - http://xml.apache.org/~dims/

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

Reply via email to