Java url POST request

Hello!
I need to access some information on a website but it requires login. I made some code but it doesn't work. The website is "www.sapo.pt" but the page source doesn't show the html form, so I have to use "http://pkgadmin.sapo.pt/xmlstyler.asp?post_action=%2Fcgi%2Fpkgadmin2-pca%2Fpca%2FLogin.tea&parOrg=SAPOADSL"
The html form is:
<form action="content.htm" method="post">
<table cellspacing="0" cellpadding="0" width="576" height="150" border="0" align="center">
<tr>
<td valign="top" width="320" class="mosaico_login">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td valign="top">
<div style="height:10px"><img alt="" src="newlayout2/images/shim.gif" width="1" height="10" hspace="0"></div>
<div class="mosaico_title">username</div>
<div><input type="hidden" name="n322" value="526"><input name="IteaComponent129523" type="text" class="mosaico" style="width:150px;" size="20" maxlength="40" id="IteaComponent2"></div>
<div style="height:4px"><img alt="" src="newlayout2/images/shim.gif" width="1" height="4" hspace="0"></div>
<div class="mosaico_title">password</div>
<div><input name="IteaComponent129524" type="password" class="mosaico" style="width:150px;" size="20" maxlength="40"></div>
<div style="height:4px"><img alt="" src="newlayout2/images/shim.gif" width="1" height="4" hspace="0"></div>
<div align="right">
<table>
<tr><!--Actions de um Form--><Input type="hidden" name="post_action" value="/cli/pkgadmin2-pca/public/Action.tea"><!--Hidden Parameters--><Input type="hidden" name="parIteaActionId" value="1341135264-1"><Input type="hidden" name="parITeaFormName" value="IteaForm129522"><td><input onmouseover="MM_swapImage('validate','','NewLayout2/images/bt_entrar_on.gif',1)" onmouseout="MM_swapImgRestore()" type="image" height="35" width="28" src="NewLayout2/images/bt_entrar_off.gif" align="right" border="0" id="validate" name="validate"></td>and this is the code I made:
          String inputNameUser;
          String inputNamePass;
          String inputLine = "";
          StringBuffer dummyLine = new StringBuffer(1024);
          int pos, firstpos = 0;
          try {
               URL ispPage = new URL("http://pkgadmin.sapo.pt/xmlstyler.asp?post_action=%2Fcgi%2Fpkgadmin2-pca%2Fpca%2FLogin.tea&parOrg=SAPOADSL");
               URLConnection ispPageConnection = ispPage.openConnection();
               BufferedReader in = new BufferedReader(new InputStreamReader(ispPageConnection.getInputStream()));
                       //this while block is because names, for the user and password field on the input tags, changes
               while((inputLine = in.readLine())!=null)
                    if((pos = inputLine.indexOf("IteaComponent"))>-1)
                         firstpos = pos;
                         if((pos = inputLine.indexOf("type", pos+1)) >-1)
                              dummyLine.append(inputLine.substring(firstpos, pos-2));
               int len = dummyLine.length();
               inputNameUser = dummyLine.substring(0, len/2);
               inputNamePass = dummyLine.substring(len/2, len);
               URL ispLogin = new URL(ispPage, "/content.htm");
               HttpURLConnection ispConnection = (HttpURLConnection)ispLogin.openConnection();
               ispConnection.setDoOutput(true);
               ispConnection.setDoInput(true);
               ispConnection.setUseCaches (false);
               ispConnection.setRequestMethod("POST");
               ispConnection.setRequestProperty("Content-type", "application/x-www-form-urlencoded");
               //ispConnection.setRequestProperty("Connection", "Keep-Alive");
               //ispConnection.setRequestProperty("Keep-Alive", "header");
               DataOutputStream outDataForm = new DataOutputStream(ispConnection.getOutputStream());
               String user = URLEncoder.encode("something@sapo", "UTF-8");
               String password = URLEncoder.encode("999999", "UTF-8");
               String content = inputNameUser+"=" + user +"&"+inputNamePass+"=" + password;
               System.out.println(content);
               outDataForm.writeBytes(content);
               outDataForm.flush();
               System.out.println(ispConnection.getResponseCode());
               outDataForm.close();
               BufferedReader inData = new BufferedReader(new InputStreamReader(ispConnection.getInputStream()));
               while((inputLine = inData.readLine()) != null)
                    System.out.println(inputLine);
               inData.close();
          catch(MalformedURLException e){}
          catch(IOException ioe){System.out.println("Error");}
           the result prints 404 for the response code, and nothing is printed on the inData stream. this stream seems to cause an IOException.
Any kind of help will be appreciated.
Thanks in advance.
P.S sorry for the bad english

Crosspost!
http://forum.java.sun.com/thread.jspa?messageID=10095495

Similar Messages

  • HTTP POST Request with XML file in

    Hi @ all,
    I would like to send an HTTP Request with an XML File in the body to an SAP System
    I have the target URL and the a XML File.
    Now the question is. Is it possible to use something like the HTTP_POST FuBa to send an url post request with an xml file?
    If yes can anybody give me a hint?
    I have a php script which exactly do this coding. But to integrate it all in one system it is necessary to transform it into ABAP and call it there.
    // compose url and request and call send function
    function test($productID, $categoryID) {
         // create url
         $PIhost = "XXX.wdf.sap.corp";
         $PIport = "50080";
         $PIurl = "/sap/xi/adapter_plain";
         $PIurl .= "?sap-client=800";
         $PIurl .= "&service=XXX";
         $PIurl .= "&namespace=XXX";
         $PIurl .= "&interface=Frontend_Interface";
         $PIurl .= "&qos=EO";
         $PIurl .= "&sap-user=XXX";
         $PIurl .= "&sap-password=XXX";
         // create xml
         $request = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
         $request .="<n1:FrontendInbound_MessageType xmlns:n1=\"http://crmpiebay.com\">\n";
         $request .= "\t<FrontendInbound>\n";
         $request .= "\t\t<ProductName/>\n";
         $request .= "\t\t<ProductCategory>".$categoryID."</ProductCategory>\n";
         $request .= "\t\t<ProductID>".$productID."</ProductID>\n";
         $request .= "\t\t<MessageID/>\n";
         $request .= "\t</FrontendInbound>\n";
         $request .= "</n1:FrontendInbound_MessageType>";
         // send http request
         postToHost($PIhost, $PIport, $PIurl, $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"]."/".$_SERVER["PHP_SELF"], $request);
    // send post request to PI server
    function postToHost($host, $port, $path, $referer, $data_to_send) {
      $fp = fsockopen($host, $port);
      if($fp) {
           $res="";
           fputs($fp, "POST $path HTTP/1.1\r\n");
           fputs($fp, "Host: $host\r\n");
           fputs($fp, "Referer: $referer\r\n");
           fputs($fp, "Content-type: text/plain\r\n");
           fputs($fp, "Content-length: ". strlen($data_to_send) ."\r\n");
           fputs($fp, "Connection: close\r\n\r\n");
           fputs($fp, $data_to_send);
           while(!feof($fp)) {
               $res .= fgets($fp, 128);
           fclose($fp);
           return $res;
    Would be great if anybody could give me a hint how to solve such a HTTP Post request with XML body data.
    Thanks in advance.
    Chris
    Edited by: Christian Kuehne on Feb 26, 2009 4:32 PM

    hi friend could you please share your solution regarding this query if u got it already?

  • Cannot add parameter or header to post request URL in Data/Services

    I'm trying to set up Data/Services in flash builder to connect to a RESTful API and as per usual Flash Builder attempts to scupper my efforts with it 'nearly but not quite' tools at every turn.
    So I need to pass a POST request with a JSON string containing auth details to the URL:
    https://myrestservice.com/rest/session/
    For authentication to work I also need to add either:
    A: an additional header containing: api_key = *my-api-key*
    or
    B: append the api key to the URL so: https://myrestservice.com/rest/session/?api_key=*my-api-key*
    Simple right? Wrong. In the data/services tool for a custom http service there seems to be no way to add a custom header. Ok annoying as even a free chrome plugin can do this but hey I can live with that, I'll use option B. Wrong again. The URL field in Data/Services will ignore the query on the end of the URL. Seriously WTF. Am I missing something here?
    So if I amend the auto-generated code in the super class and call it directly it works but if I try to take advantage of any of the tools the code is regenerated and overwrites my changes. Test Operation never works either.
    I know there is a second class which is supposed to be used to extended and override the super class but only certain overrides seem to work so for example:
    This works:
    ._serviceControl.baseurl = ("https://someotherurl.com")
    This doesn't work:
    ._serviceControl.headers = ({"api_key = *my-api-key*"})
    Oh and Test operation only seems to execute the super class. Once again a brick wall.
    Working with flash builder seems to be 50pc coding 50pc deciding if it's a bug in your code or flash builder f*****g you over.
    Any thoughts, workarounds, am I missing something would be much appreciated.
    Thanks

    Shameless bump here!
    So nobody has had this issue before?

  • Multiple POST requests

    Greetings everybody,
    For this particular question I am not getting any help from the Java forums and Google.
    Not very long ago I had to send a stream of bytes from an applet to a servlet (the applet and its helper classes are packed inside a signed jar file), but I used to fail miserably at every step.
    I tried every trick in the book (for me the books were Google and Java forums!!). I set the servlet's path in the Windows CLASSPATH, I tried to call the applet from within a servlet- of course after placing the applet file in the servlets folder- (in the hope that since the applet was in the same location as the servlets the URL would get established) e.t.c but still URL url=new URL(<servlet URL>) refused to invoke the servlet.
    Finally somehow I managed to get it done using the code below:
    public class Xyz extends Applet
    //DONT BE SURPRISED RIGHT NOW!!
    Class cls=this.getClass();
    ClassLoader cldr=cls.getClassLoader();
    //THE ACTUAL SERVLET CONNECTING CODE
    URL url=cldr.getResource("http://localhost:8000/servlet/<SomeServlet>");
    /*This statement does not work........ URL url=new URL("http://localhost:8000/servlet/<SomeServlet>").A NULL URL OBJECT GETS CREATED!! */
    HttpURLConnection hurlc=(HttpURLConnection)url.getConnection();
    //ALL THE NECESSARY FORMALITIES TO BE PERFORMED TO WRITE THE STREAM TO THE SERVLET
    hurlc.setDoInput(false);
    hurlc.setDoOutput(true);
    hurlc.setUseCaches(false);
    hurlc.setRequestMethod("POST");
    OutputStream os=hurlc.getOutputStream();
    //WRITING THE STREAM
    os.write(<some byte buffer>);
    //NOW COMES THE TRICKY PART
    hurlc.getResponseCode();
    I had to do getResponseCode() because once ClassLoader.getResource(<servlet URL>) invoked the servlet using the GET method I COULD NOT INVOKE THE SERVLET AGAIN. I had to force an invokation using getResponseCode().
    Well all is well now excepting for a small irritant. Instead of issuing one POST request the URLConnection is issuing multiple POST requests. In the Apache logs I get to see something like:
    GET /snodx/callapplet.htm 200 116
    GET /snodx/keystore_for_holding_fingerprint_for_trusted_applet 200 234
    GET /snodx/applet_and_helpers.jar 200 105
    HEAD /servlet/<SomeServlet> 200 187
    POST /servlet/<SomeServlet> 200 312
    POST /servlet/<SomeServlet> 500 604
    POST /servlet/<SomeServlet> 500 604
    The last 2 lines indicate that the servlet was invoked but the connection closed somehow. This is confirmed by taking a look at the Apache error logs:
    Premature end of script headers.
    Premature end of script headers.
    In the JServ servlet engine error logs I am getting:
    (500)apj12 returned an error handling request
    cannot scan servlet headers.
    The problem is occurring somewhere in getResponseCode().This statement is invoking the servlet using the request method set (POST) several times (2 or 3 times).
    Can someone explain what's going on?
    This is briefly the servlet code:
    public class SomeServlet extends HttpServlet
    //THE SERVICE METHOD IS CALLED BY A HEAD REQUEST TO THIS SERVLET
    public void service(ServletRequest reque,ServletResponse respon) throws ServletException,IOException
    this.doPost((HttpServletResponse)reque,(HttpServletResponse)respon);
    //GO DIRECTLY TO THE POST METHOD
    public void doPost(HttpServletRequest req,HttpServletResponse resp) throws ServletException,IOException
    ServletInputStream sis=req.getInputStream();
    if(sis.available()<2) //CHECK THAT THERE IS STREAM WHICH HAS AT LEAST 2 BYTES OF DATA!!
    log("NO STREAM FROM APPLET");
    else
    //PERFORM ALL ACTIONS TO WRITE TO STREAM OF BYTES TO A LOCAL FILE
    I have the servlet engine JServ 1.1.2 configured to run with Apache 1.3.19 on Windows 2000.
    I compiled the Applet and the Servlet using JDK1.3 and JSDK2.0. I have JRE 1.3.1_02 installed on my Win2k machine.
    Sorry for the long winded story here.
    Awaiting a reply.
    SNODX
    (The search keywords combination getResponseCode multiple POST requests +Applet and many other related keyword combinations did not match any document in the Java forums. The search string "Multiple POST requests" "getResponseCode" and many other related search strings did not match any document in Google.I am continuing the search effort however                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    interresting the classloader solution. Well if that works, i would keep it like that so far.
    But maybe this can help:
    os.write(<some byte buffer>);
    ..and then
    os.flush()//to make sure the outputstream is sent immediatly.
    //i think getResponseCode() is not necsessary in that case
    //but not certain, after all ...setUseCaches(false);
    One thing you should do is remove the complete
    service() {
    ...this.doPost();
    the reason is that when a POST arrives at the servlet, the default service-method of the ancestor class (which is javax.servlet.Servlet) will automaticaly make a call to doPost() of the javax.servlet.http.HttpServlet subclass. You should not overide it I believe.
    maybe... -try to establish an OutputStream only once in the Applet.
    - receive the other end exactly once (as you did) in the doPost as an InputStream;
    - eventually wrap both sides in respective Buffered(In)(Out)putStream(Reader)(Writer)
    - start looping and .write() and .read() at both sides on the single and same in-and-outputStream();
    (i.e avoid establishing the connection from the applet several times..., get one connection and keep it)
    sorry if this story would be irrelevant,
    Papyrus

  • Java HTTP Post Raw Data

    Hi All,
    I'm looking to make an HTTP post request given the raw data that I have. I've spent a while looking for the solution, made a handful of attempts and I'm looking for a little bit of help. The PHP code for what I'm looking to do looks like this:
    <?
    $url="http://localhost:3009";
    $postdata="<?xml version=\"1.0\" encoding=\"UTF-8\"?>
    <hi></hi>";
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
    $result = curl_exec($ch);
    curl_close($ch);
    echo($result);
    ?>
    My attempt was this:
         private String setXmlPostHeader(Document doc, PostMethod postMethod) throws java.io.IOException, java.io.UnsupportedEncodingException, javax.xml.transform.TransformerException
              ByteArrayOutputStream xmlBytes = new ByteArrayOutputStream();
              XML.serialize( doc, xmlBytes );
              final byte[] ba = xmlBytes.toByteArray();
              String data = new String(ba, "utf-8");
              InputStreamRequestEntity re = new InputStreamRequestEntity(new ByteArrayInputStream(ba));
              postMethod.setRequestEntity(re);
              postMethod.setRequestHeader("Content-type", MediaType.XML.toString() + "; charset=UTF-8");
              return data;
    And then executing the postMethod, but this simply is a post containing no data. Does anyone see anything wrong that I'm doing? Is there an easy way to set the raw http post data in java like there is in php? Thanks.
    -Ken

    Look at the PostMethod documentation. You need to set the multipart request.

  • How to make to post request to WebService

    Hi,
    How can i invoke a http Post request to webservice url,The default test page does
    not mention any thing about this when a application is deployed as a webservice,It
    only talks about a soap client.
    I know that when a application is deployed as web service in .net ,we can invoke
    it using GET,POST or SOAP request,Is it now possible in the same way in JAVA webservices.
    If it is possible to invoke using POST please refer me a sample as how to invoke
    the URL.
    thanks
    Suresh

    Hi Suresh,
    Could you write a servlet filter that would scan the first few bytes
    looking for a soap header and if you have one, let it pass through and
    if not, then do your old style processing. This is just a suggestion.
    See: http://e-docs.bea.com/wls/docs81/webapp/filters.html
    Regards,
    Bruce
    suresh wrote:
    >
    Hi,
    I want to post a plain text and not one with soap headers to the webservice.
    The reason i am looking for this is ,right now all my code is java servlets and
    clients are making http post to my service,i am now moving this to webservice
    and all the clients might not be willing to migrate to making a soap request.so
    what i am looking at is that my webservice should be able to support soap request
    as well as plain http post without the soap headers.
    please provide u'r insights
    thanks
    suresh
    Bruce Stephens <[email protected]> wrote:
    Hi Suresh,
    We have a simple tool that is helpful, the
    weblogic.webservice.tools.debug.Post utility is used to read a file and
    to post the message. See:
    http://e-docs.bea.com/wls/docs81/webserv/trouble.html
    Hope this helps,
    Bruce
    suresh wrote:
    Hi,
    How can i invoke a http Post request to webservice url,The defaulttest page does
    not mention any thing about this when a application is deployed asa webservice,It
    only talks about a soap client.
    I know that when a application is deployed as web service in .net ,wecan invoke
    it using GET,POST or SOAP request,Is it now possible in the same wayin JAVA webservices.
    If it is possible to invoke using POST please refer me a sample ashow to invoke
    the URL.
    thanks
    Suresh

  • Getting weblogic.rjvm.PeerGoneException while posting request to foreign Q

    Hi,
    There are two application deployed on 2 different weblogic server .Say application A(EJB) is deployed on weblogic 9 and Application B (Oracle service Bus) is runing on Weblogic 10.3.
    Application A sends request to a queue that is on applcation B server. Weblogic (app A) has foreign JMS server that exports the queue of app B. Configuration at Application A is :
    <foreign-server name="JmsSyncServer">
    <sub-deployment-name>SUBDEPLOYMENT_xyz</sub-deployment-name>
    <foreign-destination name="Synchronous Request Queue">
    <local-jndi-name>spain.queue.sebulasyncoutput</local-jndi-name>
    <remote-jndi-name>osb.jms.queue.extern.service.request</remote-jndi-name>
    </foreign-destination>
    <foreign-connection-factory name="Sebula Synchronous QCF">
    <local-jndi-name>spain.SebulaSyncQueueConnectionFactory</local-jndi-name>
    <remote-jndi-name>osb.jms.cf.nonXA</remote-jndi-name>
    </foreign-connection-factory>
    <initial-context-factory>weblogic.jndi.WLInitialContextFactory</initial-context-factory>
    <connection-url>t3://abcd.1.com:20001,abcd.2.com::20002</connection-url>
    </foreign-server>
    Now this cf and queue osb.jms.cf.nonXA and osb.jms.queue.extern.service.request are implemented on application B weblogic server. No authentication is given to this implementation. As soon as application A posts request to Application B following exception is thrown in application A logs :
    2010.05.21 16:31:04,919 | ERROR | SyncEaiSebulaDelegate | <null|null|U289145226331099999430000> Failed to send JMS request: properties[{ClientID=SPAIN, Operation=MsisdnDetails, message_type=sebula.sync.out, RequestTag=U289145226331099999430000}].
    com.o2.spain.jms.MessagingException: Failure during JMS setup: destination[sebula_sync_output].
    at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:85)
    at weblogic.jndi.internal.WLContextImpl.translateException(WLContextImpl.java:426)
    at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:382)
    at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:367)
    at javax.naming.InitialContext.lookup(InitialContext.java:351)
    at weblogic.deployment.jms.ForeignOpaqueReference.getReferent(ForeignOpaqueReference.java:196)
    at weblogic.jndi.internal.WLNamingManager.getObjectInstance(WLNamingManager.java:95)
    at weblogic.jndi.internal.ServerNamingNode.resolveObject(ServerNamingNode.java:348)
    at weblogic.jndi.internal.BasicNamingNode.resolveObject(BasicNamingNode.java:856)
    at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:209)
    at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:214)
    at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:214)
    at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:269)
    at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:367)
    at javax.naming.InitialContext.lookup(InitialContext.java:351)
    at com.o2.spain.jms.ServiceLocator.lookupDestination(ServiceLocator.java:130)
    at com.o2.spain.jms.ServiceLocator.getDestination(ServiceLocator.java:109)
    at com.o2.spain.jms.MessageDestinationHandler.setup(MessageDestinationHandler.java:193)
    at com.o2.spain.jms.MessageDestinationHandler.setupLazyAndAfterFailure(MessageDestinationHandler.java:165)
    at com.o2.spain.jms.MessageDestinationHandler.getTemporaryReceiver(MessageDestinationHandler.java:543)
    at com.o2.spain.jms.MessageDestination.getTemporaryReceiver(MessageDestination.java:318)
    at com.o2.spain.jms.JmsClientImpl.doRequest(JmsClientImpl.java:147)
    at com.o2.spain.jms.JmsClientImpl.request(JmsClientImpl.java:125)
    at com.o2.spain.interfaces.sebula.sync.SyncEaiSebulaDelegate.executeRequest(SyncEaiSebulaDelegate.java:345)
    at com.o2.spain.interfaces.sebula.sync.SyncEaiSebulaDelegate.getMsisdnDetails(SyncEaiSebulaDelegate.java:182)
    at com.o2.spain.ejb.SynchronousEaiFacadeBean.getMsisdnDetails(SynchronousEaiFacadeBean.java:221)
    at com.o2.spain.ejb.SynchronousEaiFacade_letkhg_ELOImpl.getMsisdnDetails(SynchronousEaiFacade_letkhg_ELOImpl.java:405)
    at com.o2.spain.ejb.SpainWebFacadeBean.getMsisdnDetails(SpainWebFacadeBean.java:1084)
    at com.o2.spain.ejb.SpainWebFacade_sesxly_ELOImpl.getMsisdnDetails(SpainWebFacade_sesxly_ELOImpl.java:1787)
    at com.o2.spain.ejb.ws.SpainWebWSPortSoapBindingImpl.getMsisdnDetails(SpainWebWSPortSoapBindingImpl.java:379)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:397)
    at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186)
    at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
    at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
    at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
    at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
    at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454)
    at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
    at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
    at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
    at com.o2.spain.ejb.ws.AxisServletFilter.doFilter(AxisServletFilter.java:29)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3242)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2010)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1916)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1366)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
    Caused by: com.o2.spain.jms.MessagingException: Failed looking up Destination [spain.queue.sebulasyncoutput].
    at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:215)
    at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:338)
    at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:252)
    at weblogic.jndi.internal.ServerNamingNode_923_WLStub.lookup(Unknown Source)
    at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:379)
    ... 58 more
    Caused by: javax.naming.CommunicationException [Root exception is weblogic.rjvm.PeerGoneException: ; nested exception is:
            java.io.EOFException]
    at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:85)
    at weblogic.jndi.internal.WLContextImpl.translateException(WLContextImpl.java:426)
    at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:382)
    ... 58 more
    Caused by: weblogic.rjvm.PeerGoneException: ; nested exception is:
    java.io.EOFException
    at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:215)
    at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:338)
    at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:252)
    at weblogic.jndi.internal.ServerNamingNode_923_WLStub.lookup(Unknown Source)
    at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:379)
    ... 58 more
    Caused by: java.io.EOFException
    at weblogic.rjvm.t3.MuxableSocketT3.endOfStream(MuxableSocketT3.java:383)
    at weblogic.socket.SocketMuxer.deliverExceptionAndCleanup(SocketMuxer.java:737)
    at weblogic.socket.SocketMuxer.deliverEndOfStream(SocketMuxer.java:684)
    at weblogic.socket.SocketMuxer.readReadySocketOnce(SocketMuxer.java:845)
    at weblogic.socket.SocketMuxer.readReadySocket(SocketMuxer.java:802)
    at weblogic.socket.DevPollSocketMuxer.processSockets(DevPollSocketMuxer.java:120)
    at weblogic.socket.SocketReaderRequest.run(SocketReaderRequest.java:29)
    at weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:42)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:145)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:117)
    It will be great if someone helps in finding out the cause....waiting for reply..
    thanks,
    Kshitij

    I had the exact same issue and found a solution here:
    http://kr.forums.oracle.com/forums/thread.jspa?threadID=755132
    "The root cause of the PGE in this instance was missing Principle classes in the remote JVM. An authenticated subject's (has our custom principles) security context is propagated to the remote JVM which throws a ClassNotFoundException, this is wrapped in the PGE."

  • Query regarding sending XML over HTTP Post request

    Hello,
    I am trying to send XML data from a server to client via HTTP Post request
    And vice versa � receive the data by a client
    Assume that the xml data looks something like
    <?xml+version="1.0"?>
    So my post query will look like
    http://<IP Address>:<port>/
    POST /MessageReceiver.jsp HTTP/1.0
    Host: www.SomeHost.net
    Content-Type: application/x-www-form-urlencoded
    Content-Length: 38
    %3C%3Fxml%2Bversion%3D%221.0%22%3F%3E+
    This information will be received by the client and converted back to xml data.
    My query is - is there some library/open-source stuff that
    does the process of transcoding the entity's non-ASCII characters
    at the server side
    and decoding the URL back to human-readable form at the client side?
    i.e. I need a simple mechanism to convert
    <?xml+version="1.0"?>
    to
    %3C%3Fxml%2Bversion%3D%221.0%22%3F%3E+
    at the server side, while sending data
    and do the opposite at the client side to get the xml back.
    Also could some one confirm if JTidy is a right tool to check if the xml is well-formed?
    Or is there any other standard tool that checks for well-formed properties of xml?
    regards,
    Deepak.

    java.net.URLEncoder / URLDecoder?
    Also could some one confirm if JTidy is a right tool to check if the xml is well-formed?No, it's for parsing HTML. An XML parser is checking for well-formedness in any case.

  • Reading POST-Request-Parameter-Values from WebDynPro now possible?

    Hello,
    in the past I always was disappointed that in WebDynPro there was no way to read POST-request-parameter-values directly after the call of a WebDynPro-Application.
    The only (documented) way to read / transfer request-data into an WebDynPro-application was via "URL query string parameters" in the request URL.
    The last week I forgot this restriction. I called my WebDynPro-application using a POST-Request-Parameter (cookie_guid) instead of an URL-parameter.
    After noticing my mistake, I was really surprised that the WebDynPro could read / shows the the POST-Request-Value.
    I didn't make any changes in the coding of my WebDynPro-Application (zvis_show_sso_cookie).
    After this cognition I built the following simple HTML-formular to analyse the behavior of the WebyDynPro by calling it with an URL-Parameter (cookie_guid=Url-GUID) together with the POST-Parameter (cookie_guid = Post-Value-GUID).
    After calling the WebyDynPro it reads / shows the "POST-Value" of the request !!!
    (Remark: If I made a simple refresh or type directly the URL "http://hg10762.vis-extranet.de:1080/sap/bc/webdynpro/sap/zvis_show_sso_cookie?sap-language=DE&cookie_guid=Url-GUID" in the browser, the same webdynpro reads / shows the URL-Parameter-Value).
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
           "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    </head>
    <body>
    <form method="post" action="http://hg10762.vis-extranet.de:1080/sap/bc/webdynpro/sap/zvis_show_sso_cookie?sap-language=DE&cookie_guid=Url-GUID">
      <table border="0" cellpadding="5" cellspacing="0" bgcolor="#E0E0E0">
        <tr>
          <td align="right">Cookie_GUID:</td>
          <td><input name="cookie_guid" type="text" size="30" maxlength="30" value="Post-Value-GUID"></td>
        </tr>
        <tr>
          <td>
            <input type="submit" value=" Absenden ">
            <input type="reset" value=" Abbrechen">
          </td>
        </tr>
      </table>
    </form>
    </body>
    </html>
    My questions:
    I there any documentation that describes the behavior of  WebDynPro after calling it by using POST-Parameter values?
    I believe in the past it wasn't possible to read POST-request-parameter-values in WD. Has SAP changed the functionality?
    Is the behavior I described in my example above mandatory?
    Regards
    Steffen

    As far as i know in general HTTP request  GET method is standard but in SAP POST is standard.  All the client request is passed as POST to the server in order to avoid the URL parameter length restriction in GET method.

  • Retrieve data/files fro HTTP POST request in On-Demand process

    Hello,
    I would like to integrate https://github.com/blueimp/jQuery-File-Upload to my APEX 4.2 application inside XE11g. I would like to use this kind of jQuery component, multiple file upload, use Drag & Drop, image resize, size limit, filter extensions etc...
    This jQuery component and also others javascript uploaders sends data files to some defined URL. Developer need to build some servlet, php script or something on server side that will read files from HTTP request and stores it somewhere.
    Do you know how to do it in APEX? How can I read data from HTTP POST request in PL/SQL? Now I can only call my On-Demand application process from javascript, but I am not able to read any data from HTTP POST in it.
    Can I do it in APEX, or using MOD_PLSQL?
    I would like to implement this:
    1) some javascript uploader will call some URL of my application and sends HTTP POST with data files
    2) I will read data files from HTTP POST and store them into database
    3) I will create some HTTP response for javascript uploader
    Thank you for some tips

    I know about that existing plugin " Item Plugin - Multiple File Upload"
    But I doesn't work in IE and has only basic features. Licence for commercial use is also needed. I would like to use some existing jQuery plugin. There are many of these plugins with nice features. And only one problem is that I need to create some server side process/servlet/script.. that can recieve HTTP request, get files from it and stores them into DB.

  • Encoding problem in call-back to hook URL (post parameters)

    Hello all,
    I'm encountering a character encoding problem while retrieving the content of the shopping basket from one of our provider.
    After the POST request is made by the provider to our system using the hook url, when debbuging I can see that some special characters are represented with the sign '#' (after the call the ITS_IMPORT_CONTEXT).
    In our case using the parameter http_content_charset with various values, including UTF-8, did not change the result.
    Inspecting the HTTP traffic has highlighted the following: the encoding received from the provider is related to UTF-8, but while we are expecting the hexadecimal values, we are receiving the "Unicode code points", which are not recognized by our SAP system. For more details look at the UTF-8 encoding table found here and compare the values under column "Unicode code point" with the one under column "UTF-8 (hex.)".
    As an example, for the character 'é', we are receiving the value "%E9" (the code point) instead of receiving the the hexa value : "%C3%A9".
    Do you have any idee if this can be corrected on our side or if the provider must addapt the way it's sending the POST parameters?
    Many thanks in advance for you help.
    Best regards,
    Jerome.

    Hi Jason,
    Indeed I had contacted the provider and informed them about the encoding problem and the fact that passing the parameter http_content_charset had no effect on the sent back encoding.
    They have taken into account my request and have changed the encoding used during the request to the HOOK_URL.
    Thanks to all of your for your help.
    Regards,
    Jerome.

  • How to fire Chunked POST Requests.

    Hi,
    Can anyone please tell me how to implement a servlet which can fire chunked POST request to the server. I have tried implementing such a servlet but it does not send the request in a chunked format.
    Please let me know what headers should this POST request necessarily have ?? (Transfer-Encoding : chunked would be one).
    Thanks in advance.
    Saurabh

    This normally isn't my area, but I saw some code yesterday which looks like what you want...
    regards,
    Owen
    protected void process (final HttpServletRequest req, final HttpServletResponse resp) throws ServletException,
                java.io.IOException
          resp.setContentType("image/svg+xml");     // This is for SVG files only
          resp.setHeader("Transfer-Encoding", "chunked");
          // rest of code....
    }

  • Truncated POST requests in IE 10 - In Response to NTLM Authentication

    In Internet Explorer 10, the browser is incorrectly truncating HTTP POST requests and submitting unsolicited NTLM negotiate headers with a  HTTP Content-Length of Zero Bytes.  This results in HTTP POST parameters failing to be submitted to the
    server.
    Assume the following web application with a context root of:
    https://w3.someapplication.net/webapplication/
    Secure cookies for this site are established at the context root of this application.
    To reproduce this issue, a secure session is established at a protection space deeper than the root context of the web app:
    https://w3.someapplication.net/webapplication/secure/login
    After establishing a secure session with the web application, some client side artifacts are retrieved from a web proxy at a higher protection space:
    https://w3.someapplication.net/webapplication/somejs.js
    Subsequent HTTP POST requests to a deeper protection space will result in IE incorrectly attempting to pass an unsolicited NTLM negotiate header to the server side, and the HTTP POST request will be truncated with a Zero Content-Length header:
    https://w3.someapplicaiton.net/webapplication/submit/form
    The result is that the HTTP POST parameters submitted to the last URL will be lost.
    This is reproducible against IE6 and IE10.  It does not reproduce against IE8, or any non-Microsoft browser which all behave in a sane manner. 
    My Questions:
    Why is IE behaving this way?
    What can I do to make IE behave properly?  Please don't suggest that I change the entire structure of my company's website to overcome this kind of silly bug in IE.
    Is there a planned fix to correct this behavior back to the proper implementation observed in IE8?
    Additional details about this problem are documented by an IE Internals blogger at the following url:
    http://blogs.msdn.com/b/ieinternals/archive/2010/11/22/internet-explorer-post-bodies-are-zero-bytes-in-length-when-authentication-challenges-are-expected.aspx
    Michael

    Yes, I have read that blog post in detail.  All of the comments from Microsoft on this issue suggest making intrusive changes to the web application side to work around this "optimization".  This is not an acceptable answer.  This
    is clearly a bug in IE.  Evidence to support that this is a bug is that the behavior within IE's own browsers is not consistent; IE6 and IE10 will reproduce this issue, IE7 and IE8 will not. 
    I don't understand your suggestion; "ensure all paths are configured to require authentication".  This is not a reasonable expectation for any normal web app.  Our application does require authentication on all paths. However, when the first
    authentication request goes through, a HTTP Session is established.  Any subsequent request to that domain will not and should not be re-authenticated.  IE making assumptions about the authentication requirements of a server side application is incorrect.
    Further, even if i did re-challenge the browser for credentials on every path, regardless of whether a session is established or not, how would I handle the requirement to serve client side artifacts from a web proxy within that secure domain?  Am I expected
    to force my web proxy to require an NTLM header to serve up a CSS file?  That is just silly.
    You also suggested that my application might be incorrectly returning a 401.  I can assure you, that is not the case.  The flow is this:
    Perform a signon to the application and retrieve some client side artifacts required by the splash page
    https://w3.myapp.com/some/app/path?query=string
    401 + www-negotiate response header
    https://w3.myapp.com/some/app/path?query=string
    browser provides a ntlm token, user is logged in, session is started
    https://w3.myapp.com/some/file.js 200 response code, no challenge from the server side
    Splash page is loaded; user submits a POST request
    https://w3.myapp.com/some/app/path POST request fails because IE truncates the request and attaches an NTLM negotiate header with Zero Byte content length.  This is an unsolicited negotiate header from IE.
    Honestly, it really irritates me when people suggest we should change our entire application structure to accommodate IE bugs or "features" that are completely outside of the HTTP spec. I understand RFC4559 states that a browser MAY initiate a request
    to a server which includes an unsolicited negotiate header, but it doesn't say anything about truncating the contents of that request. 
    No other browsers exhibit this behavior, and even the behavior within Microsoft's own product is not consistent.  It is insanely frustrating as a web developer trying to deal with all of IE's little nuances. 
    Is there anyway this can be turned off via a registry entry?  Is there any plan to fix this in a future release? 

  • Incorrect MIME type for XML Data Connection POST requests

    It appears that Xcelsius 2008u2019s XML Data Connection logic does not specify the correct MIME type for the data it sends to the server in its POST request.  Using an HTTP debug proxy, I was able to see that Xcelsius sends XML data in the POST, but is setting a content-type of u201Cx-www-form-urlencodedu201D.  According to the W3C spec:
      http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1
    Data sent with a MIME type of u201Cxxu201D should be encoded as key?value pairs, like this:
      key1=val1&key2=val2&Submit=Submit
    So, what Xcelsius is doing is clearly incorrect.  Worse, if your server process is a Java servlet, you may find that the POSTed data will be gobbled up by the servlet container and you wonu2019t be able to read it using a getInputStream(), or getReader() call because itu2019s already been processed by a call to the getParameter() method.
    The correct mime type for POSTing an XML formatted request from Xcelsius should be "text/xml".
    Wayne

    Hi,
    The Error #2032 your getting is due to the Flash player security.
    To remove this this error you need one crossdomain Xml file in the root directory which actually provides a lot more control over who has access to your data from a SWF. The cross domain policy is attached as crossdomain.xml.
    In the XML file, it is used a wildcard (*). This allows a SWF located on any machine to access your data source. You can certainly use an IP address or domain name to restrict access rather to opening it up completely. I always start with the wildcard to make sure my dashboard works, then start restricting access as necessary.
    Here is a whitepaper with everything you need to know about Flash player security:
    http://www.adobe.com/devnet/flashplayer/articles/flash_player_9_security.pdf
    Please let me know if you need any more clarification.
    Regards,
    Sanjay

  • HTTP POST Request? How? Please Help!

    Hi maybe this is a simple question. But I was able to do a GET Request from an applet to an ASP page just fine but I am having problems with the POST Request. How do you do a HTTP POST and put the parameter on the post data?
    This is what I am doing:
    url = new URL(queryParam);
    connection = (HttpURLConnection)url.openConnection();
    connection.setDoOutput(true);
    connection.setRequestMethod("POST");
    // IS THIS CORRECT WAY TO ADD PARAMETER TO POST
    connection.setRequestProperty("name","javaguy");
    BufferedReader in = new BufferedReader( new InputStreamReader( connection.getInputStream()));
    String inputLine;
    while ((inputLine = in.readLine()) != null)
    System.out.println(inputLine);
    in.close();

    The setRequestProperty() method is used to add HTTP headers to the request. The way you pass "post" parameters is to send them as the body of the message in "application/x-www-form-urlencoded" form. In other words, create a string of URLEncoded "name=value" pairs delimited by '&', just like you would see in the URL when making a GET request through the browser:
    String paramStr = "name=javaguy&occupation=web+developer" ;
    byte[] paramBuf = paramStr.getBytes("ISO-8859-1") ;
    url = new URL(queryParam);
    connection = (HttpURLConnection)url.openConnection();
    connection.setDoOutput(true);
    connection.setRequestMethod("POST");
    // THIS CORRECT WAY TO ADD PARAMETER TO POST
    connection.setRequestProperty("Content-Length", Integer.toString(paramBuf.length)) ;
    OutputStream out = connection.getOutputStream() ;
    out.write(paramBuf) ;
    out.flush() ;
    out.close() ;
    BufferedReader in = new BufferedReader( new InputStreamReader( connection.getInputStream()));
    String inputLine;
    while ((inputLine = in.readLine()) != null)
        System.out.println(inputLine);
    in.close();Good luck!

Maybe you are looking for

  • My InDesign to PDF script ignores warnings, but I need to change that.

    Hello, I have a script here that converts InDesign Docs to PDF files. It works fine and was created to make bulk pdf's regardles of missing images. Now I want to revise it so that it does stop for missing fonts and images. This script also was built

  • XSLT Mapping code

    i want to produce correct output, which is mentioned in the the blog /people/prasadbabu.nemalikanti3/blog/2006/03/30/xpath-functions-in-xslt-mapping i think there was an error in the XSLT coding. i modified the code as follows: <xsl:transform version

  • Chr(166) is null in Forms 10g runtime

    Hi! In one form I use the following line to replace characters in a string:   v_val := translate( v_val, '#$', chr( 166 ) || chr( 164 ) );The form was just migrated from 6i, and in that environment still runs fine. In the 10g environment it generated

  • Dynamic link button from speed grade to premiere is grey.

    Dynamic Link button from Speedgrade to Premier is grey. No problems Linking from Premier to SG, but no way to send the project back to Premier. The project is in Apple ProRes 4444. I have a Mac Pro last generation. Thanks for an urgent help!

  • Custom fields in Shopping cart at item level

    Dear Experts, We have a requirement to create the fields in the shopping cart. Through customizing we have defined the fields and configured them. Now we could able to see the custom fields in the Shopping cart at item level. The values to custom fie