Http request receives incomplete data

Hi,
I have an application reading one free format file via http request. This is implemented as stored procedure in a 8.1.6 database on Windows NT. The method readContent (pasted later on)takes the BufferedReader of an InputStreamReader of the InputStream of the socket connection on port 80, which I opened previously. Here is the instantiation:
sock_ = new Socket(host, port);
in_ = new BufferedReader(new
InputStreamReader(sock_.getInputStream()));
Everything works fine except that the read method on the BufferedReader refuses to read more than 20764 bytes while the http response header tells me that the content length is higher. If I compare the orginal file with the received one using a hex editor, they are identical, only that the received file is cut off after byte 20764.
Here is the logfile:
Request>> GET /download/OMIJID1234.ZIP HTTP/1.0
Response>> HTTP/1.1 200 OK
Response>> Date: Wed, 18 Apr 2001 07:26:17 GMT
Response>> Server: Apache/1.3.14 (Win32) ApacheJServ/1.1.2
Response>> Last-Modified: Wed, 18 Apr 2001 06:49:46 GMT
Response>> ETag: "0-58a4-3add390a"
Response>> Accept-Ranges: bytes
Response>> Content-Length: 22692
Response>> Connection: close
Response>> Content-Type: application/zip
Now we come to readContent method (see later on):
Number of chars read 16384
Number of chars read 4380
----------------- so far the logfile...
The total number of chars read is 20764 as you can calculate easily.
As soon as I use an orginal file which is smaller than 20764 the transfer is ok. Is there any limitation reading from a socket connection? Here is the code:
public String readContent() throws IOException
byte inChars[] = new char[16*1024];
int nofChars, totalNofChars=0;
StringBuffer sbuf = new StringBuffer();
do
nofChars = in_.read (inChars,0,inChars.length); // here is the problem !
Log.log("Number of chars read "+nofChars, Log.DEBUG); // this is the line you see in the logfile
if (nofChars != -1)
totalNofChars = totalNofChars+nofChars;
sbuf.append(inChars, 0, nofChars);
while (nofChars == inChars.length); // loop only if the buffer was filled
if (sbuf.length() == 0) {
return null; // nothing read
sbuf.setLength(sbuf.length() - 2); // cut off the trailing \r\n
return sbuf.toString();
I doubled the buffersize of the buffered reader: Same result.
I tried to check the maximum input length on the socket, and got the next error.
When I try to measure the actual buffersize with
sock_.getReceiveBufferSize();
I receive:
java.net.SocketException: Unsupported OS socket option
at
java.net.PlainSocketImpl.socketGetOption(PlainSocketImpl.jav
a)
at
java.net.PlainSocketImpl.getOption(PlainSocketImpl.java)
at java.net.Socket.getReceiveBufferSize(Socket.java)
But this method is documented for JDK 1.2, why do I get
this error ???
Any ideas with this?
Dirk

We have the same problem but our stop at 1790 bytes,
Do u mind to let us know how u solve this problem
thanx & regards
chen

Similar Messages

  • Empty HTTP Request Received

    Hi,
    I have created a Web service in XI and trying to consume it from a different system, I was successful in calling the Web service from Altova XML SPY, however when i post the service end point connection URL in internet explorer directly, I'm getting the following SOAP response. Please advise what causes this error.
    - <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
      <SOAP:Header />
    - <SOAP:Body>
    - <SOAP:Fault xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
      <faultcode>SOAP:Client</faultcode>
      <faultstring>Empty HTTP request received</faultstring>
      <faultactor>http://sap.com/xi/XI/Message/30</faultactor>
    - <detail>
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
      <SAP:Category>XIProtocol</SAP:Category>
      <SAP:Code area="MESSAGE">EMPTY_HTTP_REQUEST_RECEIVED</SAP:Code>
      <SAP:P1 />
      <SAP:P2 />
      <SAP:P3 />
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>Empty HTTP query received; message processing not possible</SAP:Stack>
      </SAP:Error>
      </detail>
      </SOAP:Fault>
      </SOAP:Body>
      </SOAP:Envelope>

    Hi,
    I am also facing the same problem . Any suggestions will be highly appreciated.
    Thanks.

  • Empty HTTP request received in SAP RFC test connection type G

    Hi all,
      While checking the RFC connection i am getting error,
    response_line               HTTP/1.0 500 Empty HTTP request received
    server_protocol             HTTP/1.0
    status_code                 500
    status_reason               Empty HTTP request received
    Please let me know if this is right.

    Hi,
      We are trying to connect to an external server. So, we are using Connection Type as G.
    RFC connection Test status is 500.
    But in our case, Idoc is getting generated but it is in the XI Box, throwing the below error,
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!-- Call Adapter
    -->
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
    <SAP:Category>XIServer</SAP:Category>
    <SAP:Code area="SECURITY">SECURITY_VERIFY_ERROR</SAP:Code>
    <SAP:P1>Check Signature</SAP:P1>
    <SAP:P2 />
    <SAP:P3 />
    <SAP:P4 />
    <SAP:AdditionalText>Signature error Error while valdiating the digital signature. Theerror was com.sap.security.core.ws.wss.NoSecurityHeaderException No wsse:Security header has been defined for role soap:finalActor. Please verify the</SAP:AdditionalText>
    <SAP:ApplicationFaultMessage namespace="" />
    <SAP:Stack>Error during message security handling in inbound channel: Security profile 'Check Signature'</SAP:Stack>
    <SAP:Retry>M</SAP:Retry>
    </SAP:Error>
    Since the RFC is working now, we were not able to find what is the issue. Even SSL certificates are valid.

  • How to Record HTTP Requests and POST data

    Hai all..
    Can anyone help me to solve this issue..
    How to Record HTTP Requests and POST data by using java..
    regards
    Ranjith Nair

    You should read about TCP and splitting data stream into packets and learn how to understand packet header to assemble stream from packets.
    Actually there are few different stages:
    1. detect handshake to start new empty stream within your code;
    2. detect subsequent packets and assemble stream (there are counters within packet header and they will help).
    After creating start of TCP stream (usually 1KB is enough) you'll be able to detect is it HTTP request/header or no and start logging or ignoring packets for this connection.

  • Http request missing form data 4.5.1

              We occassionally have problem with an Http request not having the form data that was entered. If you hit the back button and resubmit the form everything works fine.
              We have IPlanet webservers and WLS 4.5.1.
              

              We occassionally have problem with an Http request not having the form data that was entered. If you hit the back button and resubmit the form everything works fine.
              We have IPlanet webservers and WLS 4.5.1.
              

  • Reading the binary data from a http request received via socket connection.

    1. I require to extract the binary data out of a http multipart request,
    2. I have a server socket opened up, which can receive connections over tcp( and therefore http.)
    3. I will require to read the stream, find out the "request boundary identifier", and then extract the different "request body parts".
    4. From there i need to read all of the binary content and put it in a file.
    5. I did some implementation to his effect. but i see that the file that i had uploaded initially if its not a text file, gets corrupted.
    can you please let me know why is that happening, and a probable solution approach.
    please find below the class (with a main method) I have been using to expose a server socket.
    package self.services;
    import java.io.BufferedReader;
    import java.io.ByteArrayOutputStream;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.OutputStreamWriter;
    import java.io.PrintWriter;
    import java.net.ServerSocket;
    import java.net.Socket;
    public class FileServer {
         public static void main(String[] args) throws Exception {
              ServerSocket serverSocket = new ServerSocket(9999);
              String FOLDER_NAME = "uploaded_files";
              while(true) {     
                   try{
                        Socket socket = serverSocket.accept();
                        InputStream is = socket.getInputStream();
                        ByteArrayOutputStream baos = new ByteArrayOutputStream();
                        BufferedReader reader = new BufferedReader(new InputStreamReader(is));
                        String currentLine;
                        int cnt = 0;
                        boolean postRequest = false;
                        String dataBoundary = null;
                        String fileName = null;
                        String yourName = null;
                        while((currentLine = reader.readLine()) != null) {
                             if(currentLine.contains("POST")) {
                                  postRequest = true;
                                  System.out.println("POST REQ AS EXPECTED VERY NICE");
                                  continue;
                             if(!postRequest) {
                                  System.out.println("NO POST REQ THIS BREAKING FLOW");
                                  break;
                             } else {
                                  if(currentLine.contains("Content-Type: multipart/form-data; boundary=")) {
                                       System.out.println("found a boundary value header");
                                       dataBoundary = currentLine.substring((currentLine.indexOf("boundary=") + "boundary=".length()), (currentLine.length() -1));
                                       System.out.println("boundary value = ".concat(dataBoundary));
                                       continue;
                                  if(dataBoundary != null && currentLine.contains(dataBoundary)) {
                                       cnt++;
                                  if(cnt == 1) {
                                       //move 3 lines
                                       if(currentLine.contains("Content-Disposition: form-data; name=\"yourName\"")){
                                            reader.readLine();//skip a line
                                       System.out.println("Your name = ".concat(yourName = reader.readLine()));
                                       continue;
                                  } else if(cnt == 2) {
                                       if(currentLine.contains("Content-Disposition: form-data; name=\"sentFile\"; filename=\"")){
                                            fileName = currentLine.substring(currentLine.indexOf("filename=") + "filename=".length() + 1, currentLine.length() - 1);
                                            System.out.println("File Name = ".concat(fileName));
                                            reader.readLine();//skip a line , this would depict a content type header
                                            reader.readLine();//skip a line, this would indicate a blank line to mark the start of data.
                                            continue;
                                       } else {
                                            // write the content to os
                                            if(currentLine != null && !currentLine.contains(dataBoundary)) {
                                                 baos.write(currentLine.concat("\r").getBytes());
                                  } else if( cnt == 3) {
                                       System.out.println(("cnt [" + cnt).concat( "], current line [").concat(currentLine).concat("]"));
                                       break;
                        if(fileName == null ||yourName == null) {
                             System.out.println("FileServer.main() dont bother about this" );
                        } else {
                             //send a response back
                             PrintWriter pw = new PrintWriter(new OutputStreamWriter(socket.getOutputStream()));
                             pw.write(responseMessage(yourName, fileName));
                             pw.flush();
                             //close output stream
                             pw.close();
                             //handle the request bytearray.
                             FileOutputStream fos = new FileOutputStream(FOLDER_NAME + "/" + fileName);
                             fos.write(baos.toByteArray(), 0, baos.toByteArray().length - 1);
                             fos.close();
                        //close input stream
                        reader.close();
                        socket.close();
                        baos.close();
                   } catch(Exception ex) {
                        ex.printStackTrace();
         public static String responseMessage(String yourName, String fileName) {
              String response =
                   "<HTML>" .concat(
                   "<BODY>") .concat(
                   "<P>" ).concat(
                   "Mr. <FONT color=\"red\">") .concat( yourName).concat("</FONT>. Your file named <B>").concat( fileName).concat( "</B> successfully reached us." ).concat(
                   "</P>") .concat(
                   "</BODY>").concat(
                   "</HTML>");
              return response;
    }{code}
    Here is a sample html file which can be used to send multipart requests to the java service.
    <html>
         <body>
              <form action="http://localhost:9999" enctype="multipart/form-data" method="POST">
                   Enter name :<br/>
                   <input type="text" name="yourName"/>
                   Enter file :<br/>
                   <input type="file" name="sentFile"/>
                   <br/>
                   <input type="submit" value="Submit"/>
              </form>
         </body>
    </html>
    *Both the form elements are mandatory*
    *I hope my requirement is clear. Any help regarding this will be highly appreciated.*
    Regards.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    MishraC wrote:
    1. I require to extract the binary data out of a http multipart request,
    2. I have a server socket opened up, which can receive connections over tcp( and therefore http.)
    3. I will require to read the stream, find out the "request boundary identifier", and then extract the different "request body parts".
    4. From there i need to read all of the binary content and put it in a file.
    5. I did some implementation to his effect. but
    i see that the file that i had uploaded initially if its not a text file, gets corrupted.
    can you please let me know why is that happening,Because you are using a Reader (which translates bytes to chars according to the charset encoding specified).
    and a probable solution approach. Use a BufferedInputStream.

  • Doubts about HTTPS requests and Java proxy

    Hello,
    I need help about SSL connections and Java.
    I'm developing a HTTP/S proxy with Java. To test my proxy, I use Firefox. I configure the proxy option in the browser. The proxy works good with HTTP requests, but with HTTPS requests doesn't work and I don't know why.
    I explain the steps that I do for a HTTPS request:
    * The browser sends a CONNECT message to the proxy.
    I check that the proxy receives the CONNECT request correctly.
    * The proxy establish a secure connection with the content server.
    I use an SSLSocket to connect with my content server, and the SSL handshake is succesful.
    * The proxy sends a 200 HTTP response to the client:
    I send
    HTTP/1.0 200 Connection established[CRLF]
    [CRLF]
    to the application client (Firefox)
    * The proxy sends/receive data to/from Firefox/content server
    I have a Socket between Firefox and my proxy, and a SSLSocket between my proxy and my content server. I use two threads to communicate the client and the server.
    Java code:
    //Thead server-->proxy-->application(Firefox)
    ThreadComm tpa = new ThreadComm(bis_serverSSL, bos_app);
    //Thread application(Firefox)-->proxy-->server
    ThreadComm tap = new ThreadComm(bis_app, bos_serverSSL);
    The "tpa" thread reads from the SSLSocket between the proxy and the server and sends data to the Socket between the proxy and Firefox.
    The "tap" thread reads from the Socket between the proxy and Firefox and sends data to the SSLSocket between the proxy and the server.
    This is the class ThreadComm:
    public class ThreadComm extends Thread{
        private BufferedInputStream bis = null;
        private BufferedOutputStream bos = null;
        public ThreadComm(BufferedInputStream bis, BufferedOutputStream bos) {
            this.bis = bis;
            this.bos = bos;
        @Override
        public void run() {
            int b = -1;
            FileOutputStream fos = null;
              do {
                   try {
                        b = bis.read();
                        System.out.print((char) b);
                        fos.write(b);
                        bos.write(b);
                        bos.flush();
                   } catch (Exception ex) {
                        Logger.getLogger(ThreadAplicacionProxy.class.getName()).log(Level.SEVERE, null, ex);
                        //b=-1;
              } while (b != -1);
        }But this doesn't work and I don't know why.      
    I have an Apache server with the mod_ssl enabled as content server, I can send requests (with Firefox) to the port 80(HTTP request) and 443(HTTPS request) without use my proxy and it works. If I use my proxy, HTTP request works but with HTTPS request doesn't work, I look the log of Apache and I see:
    [Tue Apr 27 17:32:03 2010] [info] Initial (No.1) HTTPS request received for child 62 (server localhost:443)
    [Tue Apr 27 17:32:03 2010] [error] [client 127.0.0.1] Invalid method in request \x80\x7f\x01\x03\x01
    [Tue Apr 27 17:32:03 2010] [debug] ssl_engine_kernel.c(1770): OpenSSL: Write: SSL negotiation finished successfully
    [Tue Apr 27 17:32:03 2010] [info] [client 127.0.0.1] Connection closed to child 62 with standard shutdown (server localhost:443)
    Why it say? Invalid method in request \x80\x7f\x01\x03\x01 , my proxy sends the data that the Firefox sends.
    I think than I have follow the explanations of [1] but doesn't work, I have problems in implementation in Java but I don't know where.
    I appreciate any suggestions.
    Thanks for your time.
    [1] http://www.web-cache.com/Writings/Internet-Drafts/draft-luotonen-web-proxy-tunneling-01.txt

    ejp, I have checked the socket between the proxy and server and ... You are right! , I was using the port 80 instead of the 443 (incredible mistake!, I'm sorry). I was convinced that I was using the port 443... Well, is a little step, but I still have not won the war :)
    If I see the log files of Apache, We can see that something goes wrong.
    localhost-access.log
    >
    127.0.0.1 - - [04/May/2010:17:44:48 +0200] "\x 80\x 7f\x01\x03\x01" 501 219
    >
    localhost-error.log
    >
    [Tue May 04 17:44:48 2010] [info] Initial (No.1) HTTPS request received for child 63 (server localhost:443)
    [Tue May 04 17:44:48 2010] [error] [client 127.0.0.1] Invalid method in request \x80\x7f\x01\x03\x01
    [Tue May 04 17:44:48 2010] [debug] ssl_engine_kernel.c(1770): OpenSSL: Write: SSL negotiation finished successfully
    [Tue May 04 17:44:48 2010] [info] [client 127.0.0.1] Connection closed to child 63 with standard shutdown (server localhost:443)
    >
    I think that this happens because Apache receives the data without decrypt, this is the reason because in the log we can see the "Invalid method in request \x80\x7f\x01\x03\x01". This supposition is true?
    ejp, you say that the "Termination is quite tricky." I have changed my code following yours suggestions (using the join and the shutdownOutput) but the threads don't die.
    I explain you what I do:
    (in time 1)
    I launch the thread (threadFirefoxToApache) that reads data from Firefox and sends to Apache.
    I launch the thread (threadApacheToFirefox) that reads data from Apache and sends to Firefox.
    (in time 2)
    threadFirefoxToApache sends the firts data to the server.
    threadApacheToFirefox is waiting that the server says something.
    (in time 3)
    threadFirefoxToApache is waiting that Firefox says something.
    threadApacheToFirefox sends data to Firefox.
    (in time 4)
    threadFirefoxToApache is waiting that Firefox says something.
    threadApacheToFirefox is waiting that Firefox says something.
    and they are waiting... and never finish.
    In time 2, these first data are encrypted. The server receives these data and It doesn't understand. In time 3, the server sends a HTTP response "501 Method Not Implemented", here there is a problem because this data must be encrypt. According to the documentation that I read, the proxy cannot "understand" this data but I can "understand" this data. What's happen?
    Firefox encrypt the data and send to the proxy. This It's correct.
    The proxy encrypt the data another time, because I use the SSLSocket to send the data to the server. Then the server receives the data encrypted two times, when decrypt the data gets the data encrypted one time. And this is the reason why the server doesn't understand the data that sends Firefox. It's correct? May be.
    Then If I want that the server receives the data encrypted one time I need to use the socketToServer, It's correct?
    I will supposed that yes. If I use the socketToServer, the proxy doesn't understand nothing, because the data received from the socketToServer are encrypted (I only see simbols), but the Apache log says that there is a problem with the version? (If I use the socketToServer the threads die)
    >
    [Tue May 04 19:55:42 2010] [debug] ssl_engine_kernel.c(1760): OpenSSL: Loop: SSLv3 read finished A
    [Tue May 04 19:55:42 2010] [debug] ssl_engine_kernel.c(1760): OpenSSL: Loop: SSLv3 write change cipher spec A
    [Tue May 04 19:55:42 2010] [debug] ssl_engine_kernel.c(1760): OpenSSL: Loop: SSLv3 write finished A
    [Tue May 04 19:55:42 2010] [debug] ssl_engine_kernel.c(1760): OpenSSL: Loop: SSLv3 flush data
    [Tue May 04 19:55:42 2010] [debug] ssl_engine_kernel.c(1756): OpenSSL: Handshake: done
    [Tue May 04 19:55:42 2010] [info] Connection: Client IP: 127.0.0.1, Protocol: TLSv1, Cipher: RC4-MD5 (128/128 bits)
    [Tue May 04 19:55:42 2010] [debug] ssl_engine_io.c(1817): OpenSSL: read 5/5 bytes from BIO#29bd910 [mem: 29ea0a8] (BIO dump follows)
    [Tue May 04 19:55:42 2010] [debug] ssl_engine_io.c(1750): -------------------------------------------------------------------------
    [Tue May 04 19:55:42 2010] [debug] ssl_engine_io.c(1789): | 0000: 80 7f 01 03 .... |
    [Tue May 04 19:55:42 2010] [debug] ssl_engine_io.c(1793): | 0005 - <SPACES/NULS>
    [Tue May 04 19:55:42 2010] [debug] ssl_engine_io.c(1795): ------------------------------------------------------------------------
    [Tue May 04 19:55:42 2010] [debug] ssl_engine_kernel.c(1770): OpenSSL: Write: SSL negotiation finished successfully
    [Tue May 04 19:55:42 2010] [info] [client 127.0.0.1] SSL library error 1 reading data
    [Tue May 04 19:55:42 2010] [info] SSL Library Error: 336130315 error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number
    [Tue May 04 19:55:42 2010] [debug] ssl_engine_kernel.c(1770): OpenSSL: Write: SSL negotiation finished successfully
    [Tue May 04 19:55:42 2010] [info] [client 127.0.0.1] Connection closed to child 63 with standard shutdown (server localhost:443)
    >
    What option is the correct? I need use the SSLSocketToServer or socketToServer to send/read the data to/from the server?. Use the SSLSocket has sense because the data travel in a secure socket, but use the Socket also has sense because the data are encrypted and they are protected by this encription. It's complicated...

  • Java Networking - displaying HTTP Request stream

    Hi all,
    I am using java.net.HttpURLConnection object to get a response from a http server. I need to see/display the actual HTTP Request stream (containing POST HTTP/1.1 etc.) being sent to the server. How do I do it?
    Please help.
    Nikhil

    Pete_The_Hat,
    Thanks a lot for advising the packet sniffer. It works pretty well for HTTP requests. However, for HTTPS requests (SSL), the data in the packets (that I can see through the sniffer) is encrypted. How do I collaborate with the Browser (where the encryption/decryption keys are stored) to see the decrypted/unencrypted code?
    It seems too much of work to manually assemble the encrypted data from different packets and then try to decrypt it somehow.
    What's the right approach to see/sniff unencrypted HTTPS Streams? It appears to me to be outside the realm of packet sniffers because data in SSL packets is already encrypted before packets are constructed.
    Networking Gurus please help.

  • Application that receive SOAP and normal http request

    Hi Guys,
    I've been working onto web service right now using Spring. Been using this for receiving SOAP requests... Right now its working smoothly. But I want my application to cater both SOAP request and normal http request. Is that possible? If yes, can you guide me how?

    Sorry for the formatting above.  I interspersed lines between the questions, but they seem to have mostly disappeared.

  • OfficialFile.asmx The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM'. ERROR

    We are getting an error on the authentication piece when trying to submit a file to the OfficialFile.asmx web service to submit a document to the Drop-Off Library. Here is the code snippet -
    public string FileUpload(HttpPostedFile FileInput, RecordsRepositoryProperty[] properties)
    string strFileUrl = string.Empty;
    RecordsRepositorySoapClient repository = new RecordsRepositorySoapClient();
    BinaryReader b = new BinaryReader(FileInput.InputStream);
    byte[] binData = b.ReadBytes(FileInput.ContentLength);
    repository.ClientCredentials.Windows.ClientCredential = new System.Net.NetworkCredential(iUserID, iUserPassword, iUserDomain);
    repository.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
    repository.SubmitFile(binData, properties, null, FileInput.FileName, HttpContext.Current.User.Identity.Name);
    strFileUrl = repository.GetFinalRoutingDestinationFolderUrl(properties, null, FileInput.FileName).Url;
    return strFileUrl;
    Although we are setting the network credential in the client call we still get the error
    - The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM'.
    Ideas?
    Thanks in advance.

    Hi,
    Based on the error message, the issue is related to the authentication type.
    I suggest you can specify the credential type like the below:
    CredentialCache credentialCache = new CredentialCache();
    NetworkCredential credentials = new NetworkCredential(UserName, PassWord, sDomain);
    credentialCache.Add(new Uri(recordCenterUrl), "NTLM", credentials);
    Here is a detailed code demo for your reference:
    http://blogs.msdn.com/b/mcsnoiwb/archive/2011/06/06/sending-files-to-a-record-center-using-the-sp2010-webservice-officialfile-asmx.aspx
    Best Regards
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Jerry Guo
    TechNet Community Support

  • How will u receive the data into XI when HTTP as sender?

    How will u receive the data into XI when HTTP as sender?

    Hi,
    There is no need to a Sender HTTP adapter, the URL that you are using from the source system to send data to XI will directly post into the integration server.
    http://help.sap.com/saphelp_nw04/helpdata/en/43/64db4daf9f30b4e10000000a11466f/content.htm
    Regards,
    Prakash

  • Capture data from a http request

    i am really new learning abap and i just playing around so i looking a way for capture data from a http request giving the request value and submit for respont something like :
    put the url "http://www.imdb.com/find?s=all&q=" in some way and way for the data to request by the user
    val = 'user_entry'
    result =(any_Function)http://www.imdb.com/find?s=all&q=val
    write / result.
    pd: sorry for my bad english

    Welcome to SDN.
    If you are saying that you want to read some request from the HTTP page,then you have to do it with BSP instead of ABAP.
    Check this link for BSP.
    /message/1688265#1688265 [original link is broken]
    Regards,
    Amit
    Reward all helpful replies.

  • Creation of shopping cart through HTTP request

    Hello all, I am trying to create a shopping cart through a HTTP request.
    The URL I am managing is the same that the one that the Web Service BBPSC01 uses.
    Using the following code I cannot connect to the server in background, the error "This browser is not supported" is launched.
    In addition to this, I can open the URL successfully via R/3 when executing online.
    Help very appreciated!
    Thanks.
    data declarations
    DATA: client TYPE REF TO if_http_client.
    DATA: host      TYPE string VALUE 'host',
          host2      TYPE string,
          service   TYPE string VALUE '8000',
          path      TYPE string VALUE '/sap/bc/gui/sap/its/bbpsc01/?sap-client=020&sap-language=EN',
          errortext TYPE string. "used for error handling
    DATA: dest(13) TYPE c.
    dest = 'ZPORTAL_CESTA'.
    CALL METHOD cl_http_client=>create_by_destination
      EXPORTING
        destination              = dest
      IMPORTING
        client                   = client
      EXCEPTIONS
        destination_not_found    = 1
        internal_error           = 2
        argument_not_found       = 3
        destination_no_authority = 4
        plugin_not_active        = 5
        OTHERS                   = 6.
    IF sy-subrc NE 0.
      WRITE: / 'Create failed, subrc = ', sy-subrc.
      EXIT.
    ENDIF.
    set http method POST
    CALL METHOD client->request->set_method(
      if_http_request=>co_request_method_post ).
    client->request->set_version(
         if_http_request=>co_protocol_version_1_1 ).
    client->request->set_header_field( name = '~request_method'
    value = 'GET' ).
    set request uri (/<path>[?<querystring>])
    DATA uri TYPE string.
    uri = path.
    cl_http_utility=>set_request_uri( request = client->request
                                      uri     = uri ).
    FIN: conectamos el final de la peticion
    Send
    DATA timeout TYPE i.
    CALL METHOD client->send
      EXPORTING
        timeout                    = timeout
      EXCEPTIONS
        http_communication_failure = 1
        http_invalid_state         = 2
        http_processing_failed     = 3
        OTHERS                     = 4.
    IF sy-subrc NE 0.
      DATA: subrc TYPE sy-subrc.
      CALL METHOD client->get_last_error
        IMPORTING
          code    = subrc
          MESSAGE = errortext.
      WRITE: / 'communication_error( send )',
             / 'code: ', subrc,
             / 'message: ', errortext.
      EXIT.
    ENDIF.
    CALL METHOD client->receive
      EXCEPTIONS
        http_communication_failure = 1
        http_invalid_state         = 2
        http_processing_failed     = 3
        OTHERS                     = 4.
    IF sy-subrc NE 0.
      CALL METHOD client->get_last_error
        IMPORTING
          code    = subrc
          MESSAGE = errortext.
      WRITE: / 'communication_error( receive )',
             / 'code: ', subrc, 'message: '.
      EXIT.
    ENDIF.
    DATA return_str TYPE string.
    return_str = client->response->get_cdata( ).
    close
    CALL METHOD client->close
      EXCEPTIONS
        http_invalid_state = 1
        OTHERS             = 2.
    DATA html_control TYPE REF TO cl_gui_html_viewer.
    DATA container   TYPE REF TO cl_gui_custom_container.
    DATA html_table TYPE TABLE OF char255.
    Create container for HTML viewer
    CREATE OBJECT container
      EXPORTING
        container_name              = 'CONTAINER'
      EXCEPTIONS
        cntl_error                  = 1
        cntl_system_error           = 2
        create_error                = 3
        lifetime_error              = 4
        lifetime_dynpro_dynpro_link = 5.
    IF sy-subrc NE 0.
      MESSAGE e208(00)
         WITH 'The control HTML_CONTAINER could not be created'.
    ENDIF.
    CREATE OBJECT html_control
      EXPORTING
        parent = container.
    CALL FUNCTION 'CONVERT_STRING_TO_TABLE'
      EXPORTING
        i_string         = return_str
        i_tabline_length = 255
      TABLES
        et_table         = html_table.
    DATA: l_doc_url(255) TYPE c.
    CALL METHOD html_control->load_data
      EXPORTING
        type         = 'text'
        subtype      = 'html'
      IMPORTING
        assigned_url = l_doc_url
      CHANGING
        data_table   = html_table.
    CALL METHOD html_control->show_url
      EXPORTING
        url = l_doc_url.

    Dear Poster
    Your thread has had no response since it's creation over
    2 weeks ago, therefore, I recommend that you either:
    - Rephrase the question.
    - Provide additional Information to prompt a response.
    - Close the thread if the answer is already known.
    Thank you for your compliance in this regard.
    Jason Boggans
    SAP SRM SDN Moderator

  • PL/SQL posting to HTTP request

    Hi
    As part of a web application I am developing, I need to generate an HTTP post from a PL/SQL package. The problem I am having is that the message going out is not properly formatted and is being rejected by the listening application (in this case, WebCT)
    The MIME message should be formatted like this. (this is what I get when I use Perl to generate the call...)
    POST /webct/systemIntegrationApi.dowebct HTTP/1.1
    Host: roach:4041
    Connection: Keep-Alive, TE
    TE: trailers, deflate, gzip, compress
    User-Agent: RPT-HTTPClient/0.3-3E
    Accept-Encoding: deflate, gzip, x-gzip, compress, x-compress
    Content-type: multipart/form-data; boundary=WebCT_Enterprise_API_boundary
    Content-length: 1506
    --WebCT_Enterprise_API_boundary
    Content-Disposition: form-data; name="adapter"
    ims
    --WebCT_Enterprise_API_boundary
    Content-Disposition: form-data; name="ACTION"
    import
    --WebCT_Enterprise_API_boundary
    Content-Disposition: form-data; name="OPTION"
    unrestrict
    --WebCT_Enterprise_API_boundary
    Content-Disposition: form-data; name="SCTMODE"
    OFF
    --WebCT_Enterprise_API_boundary
    Content-Disposition: form-data; name="TIMESTAMP"
    1091141996
    --WebCT_Enterprise_API_boundary
    Content-Disposition: form-data; name="AUTH"
    3D 1F DC E0 F7 15 5A 1F F4 99 CA 70 D4 68 1C 57
    --WebCT_Enterprise_API_boundary
    Content-Disposition: form-data; name="FILENAME"; filename="baseline_import.xml"
    <?xml version="1.0" encoding="iso-8859-1"?>
    <!DOCTYPE ENTERPRISE SYSTEM "IMS-EP01.dtd">
    <ENTERPRISE>
    <PROPERTIES>
    <DATASOURCE>McGill University SCT Banner</DATASOURCE>
    <TYPE>Initial Creation</TYPE>
    <DATETIME>2000-00-00T12:00:00</DATETIME>
    </PROPERTIES>
    <GROUP>
    <SOURCEDID>
    <SOURCE>Banner 2000 SCT Banner</SOURCE>
    <ID>6536.200409</ID>
    </SOURCEDID>
    <DESCRIPTION>
    <SHORT>HIST-666-001</SHORT>
    </DESCRIPTION>
    <RELATIONSHIP myrelationship="3">
    <SOURCEDID>
    <SOURCE>Banner 2000 SCT Banner</SOURCE>
    <ID>6537.200409</ID>
    </SOURCEDID>
    </RELATIONSHIP>
    </GROUP>
    </ENTERPRISE>
    WebCT_Enterprise_API_boundary
    HTTP/1.1 200 OK
    Date: Thu, 29 Jul 2004 21:56:27 GMT
    Server: Apache/2.0.49 (Unix) DAV/2 mod_ssl/2.0.49 OpenSSL/0.9.6m mod_jk/1.2.3-dev
    Keep-Alive: timeout=15, max=100
    Connection: Keep-Alive
    Transfer-Encoding: chunked
    Content-Type: text/html
    35
    Success: Import file (baseline_import.xml) complete.
    0
    My PL/SQL code that tries to build the outgoing call is
    req := utl_http.begin_request('http://atlas.cc.mcgill.ca:8900/webct/systemIntegrationApi.dowebct','POST', 'HTTP/1.1');
    utl_http.write_text(req,'Content-type: multipart/form-data; boundary=WebCT_Enterprise_API_Boundary' || CHR(13)|| CHR(10) ||
                   '' || CHR(13)|| CHR(10) ||
                   '--WebCT_Enterprise_API_Boundary' || CHR(13)|| CHR(10) ||
                   'Content-Disposition: form-data; name="adapter"' || CHR(13)|| CHR(10) ||
                   '' || CHR(13)|| CHR(10) ||
                   'ims' || CHR(13)|| CHR(10) ||
                   '--WebCT_Enterprise_API_Boundary' || CHR(13)|| CHR(10) ||
                   'Content-Disposition: form-data; name="ACTION"' || CHR(13)|| CHR(10) ||
                   '' || CHR(13)|| CHR(10) ||
                   'import' || CHR(13)|| CHR(10) ||
                   '--WebCT_Enterprise_API_Boundary' || CHR(13)|| CHR(10) ||
                   'Content-Disposition: form-data; name="OPTION"' || CHR(13)|| CHR(10) ||
                   '' || CHR(13)|| CHR(10) ||
                   'unrestrict' || CHR(13)|| CHR(10) ||
                   '--WebCT_Enterprise_API_Boundary' || CHR(13)|| CHR(10) ||
                   'Content-Disposition: form-data; name="SCTMODE"' || CHR(13)|| CHR(10) ||
                   '' || CHR(13)|| CHR(10) ||
                   'OFF' || CHR(13)|| CHR(10) ||
                   '--WebCT_Enterprise_API_Boundary' || CHR(13)|| CHR(10) ||
                   'Content-Disposition: form-data; name="TIMESTAMP"' || CHR(13)|| CHR(10) ||
                   '' || CHR(13)|| CHR(10) ||
                   timestamp || CHR(13)|| CHR(10) ||
                   '--WebCT_Enterprise_API_Boundary' || CHR(13)|| CHR(10) ||
                   'Content-Disposition: form-data; name="AUTH"' || CHR(13)|| CHR(10) ||
                   '' || CHR(13)|| CHR(10) ||
                   mac || CHR(13)|| CHR(10) ||
                   '--WebCT_Enterprise_API_Boundary' || CHR(13)|| CHR(10) ||
                   'Content-Disposition: form-data; name="FILENAME"; filename="xlist.xml"' || CHR(13)|| CHR(10) ||
                   '' || CHR(13)|| CHR(10) ||
                   total_xml_string || CHR(13)|| CHR(10) ||
                   '--WebCT_Enterprise_API_Boundary--' || CHR(13)|| CHR(10));
    resp := utl_http.get_response(req);
    utl_http.read_text(resp, val);
    utl_http.end_response(resp);
    When I watch the network traffic generated by this PL/SQL I do not have any carriage returns which makes WebCT to believe that the message does not carry the proper data and returns Fatal Failure(99): Invalid URL arguments...
    Is there somewhere where I can see sample code for placing HTTP requests using the utl_http package? Or if I am doing something obviously wrong (I am new at this whole PL/SQL thing...) please let me know.
    Thank you
    Bogdan

    If UTL_HTTP.SET_TRANSFER_TIMEOUT has no effect, probably your hang is due to the fact that the machine is completely down and inaccessible.
    As the name suggests, SET_TRANSFER_TIMEOUT only controls the timeout when UTL_HTTP succeeds in making a connection to the remote Web server and it times out the request when no more response is received by certain time while the connection is not closed by the remote server either.
    In your case, you probably need a connect-timeout which isn't provided by UTL_HTTP (yet).

  • Embedded "multipart/encrypted" HTTP Request?

    Hi,
    I am using 'httpclient.jar'. I am able to successfully send a normal HTTPRequest and receive the response using the 'MultipartRequestEntity' class.
    Now, I need to send an Embedded HTTP Request as mentioned below. Kindly suggest how can I send an Embedded HTTPRequest and how do I set the 'RequestHeader' to change the 'Content Type' to "multipart/encrypted".
    POST /RecipientServer/mailbox HTTP/1.1
    Date: Tue, 20 Dec 2000 08:12:31 GMT
    Connection: Keep-Alive
    Host: www.ontarioRecipientServer.com
    Content-Language: en, fr
    Content-Type: multipart/form-data; boundary=EBTpart;
    Content-Length: 3222
    --EBTpart
    Content-Disposition: form-data; name=”sender”
    12345678
    --EBTpart
    Content-Disposition: form-data; name=”user_id”
    aUser
    --EBTpart
    Content-Disposition: form-data; name=”user_password”
    aPassword
    --EBTpart
    Content-Disposition: form-data; name=”request_type”
    Upload
    --EBTpart
    Content-Disposition: form-data; name=”ebt_document”; filename=”transaction.xml”
    Content-Type: application/octet-stream
    MIME-Version: 1.0
    Content-Type: multipart/encrypted; boundary=”=--”;
    protocol="application/pgp-encrypted"
    --=--
    Content-Type: pgp-encrypted
    Version: 1
    --=--
    Content-Type: application/octet-stream
    -----BEGIN PGP MESSAGE-----
    Version: 2.6.2
    hIwDY32hYGCE8MkBA/wOu7d45aUxF4Q0RKJprD3v5Z9K1YcRJ2fve87lMlDlx4OjeW4GDdBfLbJE7VUpp13N19GL8e/AqbyyjHH4aS0YoTk10QQ9nnRvjY8nZL3MPXSZg9VGQxFeGqzykzmykU6A26MSMexR4ApeeON6xzZWfo+0yOqAq6lb46wsvldZ96YA AABH78hyX7YX4uT1tNCWEIIBoqqvCeIMpp7UQ2IzBrXg6GtukS8NxbukLeamqVW31yt21DYOjuLzcMNe/JNsD9vDVCvOOG3OCi8=
    =zzaA
    -----END PGP MESSAGE-----
    --=----
    EBTpart

    Hi,
    I am using 'httpclient.jar'. I am able to successfully send a normal HTTPRequest and receive the response using the 'MultipartRequestEntity' class.
    Now, I need to send an Embedded HTTP Request as mentioned below. Kindly suggest how can I send an Embedded HTTPRequest and how do I set the 'RequestHeader' to change the 'Content Type' to "multipart/encrypted".
    POST /RecipientServer/mailbox HTTP/1.1
    Date: Tue, 20 Dec 2000 08:12:31 GMT
    Connection: Keep-Alive
    Host: www.ontarioRecipientServer.com
    Content-Language: en, fr
    Content-Type: multipart/form-data; boundary=EBTpart;
    Content-Length: 3222
    --EBTpart
    Content-Disposition: form-data; name=”sender”
    12345678
    --EBTpart
    Content-Disposition: form-data; name=”user_id”
    aUser
    --EBTpart
    Content-Disposition: form-data; name=”user_password”
    aPassword
    --EBTpart
    Content-Disposition: form-data; name=”request_type”
    Upload
    --EBTpart
    Content-Disposition: form-data; name=”ebt_document”; filename=”transaction.xml”
    Content-Type: application/octet-stream
    MIME-Version: 1.0
    Content-Type: multipart/encrypted; boundary=”=--”;
    protocol="application/pgp-encrypted"
    --=--
    Content-Type: pgp-encrypted
    Version: 1
    --=--
    Content-Type: application/octet-stream
    -----BEGIN PGP MESSAGE-----
    Version: 2.6.2
    hIwDY32hYGCE8MkBA/wOu7d45aUxF4Q0RKJprD3v5Z9K1YcRJ2fve87lMlDlx4OjeW4GDdBfLbJE7VUpp13N19GL8e/AqbyyjHH4aS0YoTk10QQ9nnRvjY8nZL3MPXSZg9VGQxFeGqzykzmykU6A26MSMexR4ApeeON6xzZWfo+0yOqAq6lb46wsvldZ96YA AABH78hyX7YX4uT1tNCWEIIBoqqvCeIMpp7UQ2IzBrXg6GtukS8NxbukLeamqVW31yt21DYOjuLzcMNe/JNsD9vDVCvOOG3OCi8=
    =zzaA
    -----END PGP MESSAGE-----
    --=----
    EBTpart

Maybe you are looking for

  • RGB poor quality compared to CMYK

    I have a vector map which was brought from iStock and changed the color on it. The edited version is in CMYK format and I need both a CMYK version for print and RGB for screen. The map needs to be used in PowerPoint and I have tried to zoom in quite

  • Node.js loss of permission to write/create log files

    We have been operating Node.js as a worker role cloud service. To track server activity, we write log files (via log4js) to C:\logs Originally the logging was configured with size-based roll-over. e.g. new file every 20MB. I noticed on some servers t

  • A few iPhone questions

    I'm trying to decide if the iPhone is better than my 4.5 year old Sony Ericsson s710a. I know that sounds weird, but I really love my phone. I'm also not a big Apple fan, so getting this phone would be a big leap for me. My current phone has a some b

  • Before Aggregation in NW2004s(BI7)

    Hi Bex Gurus,   We have upgraded our BI System to NW2004s and Bex version is still 3.5.   Now we are also planning to migrate Bex to new version(NW2004s ).   We have used "Before Aggregation" in some of the calculated KFs in the queries.  "Before Agg

  • The "air." prefix does not apear in my app.xml

    Hi I am publishing an app for the Amazon store using the Flash Pro CS6. after I publish my app I noticed  that the is no  "air." prefix in the <id> tag in my app.xml.  The "air." prefix is a default in the Flash Pro CS6 publish settings and cannot be