Send a string to php

Basically this again another new research for myself.
What I'm trying to do: send out a var from as2 as a string, to a php file that would write that string down to a txt file (test.txt)
I don't know how to do it, but I have this sample on hand ( which upload a file from local computer to server).
What I'm trying to learn from this sample is how php grab data sending over from as2, so if anyone can point out which part in the php file that holds the name of the uploading object.
very grateful,
as2:
import flash.net.FileReference;
var fileRef:FileReference = new FileReference();
var oListener:Object = new Object();
fileRef.addListener(oListener);
oListener.onSelect = function(fileRef:FileReference):Void {
    tData.text = "File Name: " + fileRef.name;
tBrowse.onPress = function() {  << tBrowse is a button
    browseFiles();
function browseFiles(): Void {
    fileRef.browse();
tUpload.onPress = function() {
    uploadFile();
function uploadFile():Void {
    fileRef.upload("simplefileupload.php");
php code "simplefileupload.php"
<?php
move_uploaded_file($_FILES['Filedata']['tmp_name'], './'.$_FILES['Filedata']['name']);
?>

Hi, I found a online tut, I have these codes on my swf, I don't why it isn't working, do I need to import some lib?
var urlReq:URLRequest = new URLRequest ("getVars.php");
submitT.addEventListener(MouseEvent.CLICK, send2php);      <<submitT is a button
function send2php(evt:MouseEvent):void {      
    // Set the method to POST
    urlReq.method = URLRequestMethod.POST;
    // Define the variables to post   
    var urlVars:URLVariables = new URLVariables();
    urlVars.userName = 'myUsername';
    urlVars.userPass = 'myPassword';
    // Add the variables to the URLRequest
    urlReq.data = urlVars; 
    // Add the URLRequest data to a new Loader
    var loader:URLLoader = new URLLoader (urlReq);
    // Set a listener function to run when completed
    //loader.addEventListener(Event.COMPLETE, onLoginComplete);
    // Set the loader format to variables and post to the PHP
    loader.dataFormat = URLLoaderDataFormat.VARIABLES;
    loader.load(urlReq);
And these on getVars.php,
<?php
    //Grab username and password variables
    $username = $_POST['userName'];
    $password = $_POST['userPass'];
    // for additional variables use the &
    // success=true&username=$username&password=$password
    echo $username;
    echo $password;
    echo "success=true";
?>

Similar Messages

  • Sending string to php script using HttpConnection, OutputStream, POST

    I am currently building an imode application using DoJa 2.5 standards and the problem I'm having is that when I send a string to a php script using a HttpConnection object and an OuputStream object via Http POST method, It does not seem to be sent at all. You'll probably understand a little better if you read the following code:
    * main.java
    * DATE : 2005/12/19 14:47
    import com.nttdocomo.ui.IApplication;
    import com.nttdocomo.ui.Display;
    import com.nttdocomo.util.Phone;
    import com.nttdocomo.io.HttpConnection;
    import java.io.*;
    import javax.microedition.io.*;
    import com.nttdocomo.net.URLEncoder;
    * main
    * @TetraCON
    public class main extends IApplication
         // Declareer een object van de klasse Gebruiker
         public Gebruiker gebruiker;
         // Declareer een object van de mainpanel klasse
         private MainPanel mainPanel;
         public void start()
              //Maak object van Gebruiker aan met het sim_nr van de simkaart
              gebruiker = new Gebruiker(Phone.getProperty("terminal-id"));
              /* Testing... *************/
              System.out.println(gebruiker.getSim_nr());
              // Declareer een nog niet ingestelde HttpConnection
              HttpConnection con = null;
              OutputStream out = null;
              InputStream is = null;          
              try
                   // Stel de parameters van de HttpConnection in en krijg er een object van
                    //con = (HttpConnection)Connector.open( IApplication.getCurrentApp().getSourceURL() + "validate-terminal.php", Connector.READ_WRITE, true);
    /* Testing.... ****************/
    con = (HttpConnection)Connector.open( IApplication.getCurrentApp().getSourceURL() + "validate-terminal-test.php", Connector.READ_WRITE, true);
                   con.setRequestMethod(HttpConnection.POST);
                   con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
                   // Declareer een OutputStream en link deze aan de HttpConnection
                   out = con.openOutputStream();
                   // Zet het te versturen sim_nr in de buffer van de OutputStream
                   out.write((URLEncoder.encode("sim_nr=" + gebruiker.getSim_nr())).getBytes());
                   // Sluit de OutputStream
                   out.close();
                   // Maak verbinding met de server en verstuur het sim_nr
                   con.connect();
                   // Declareer een InputStream en link deze aan de HttpConnection
                   is = con.openInputStream();
                   // Declareer een byte array van 20 bytes om de data in op te vangen
                   byte[] b = new byte[200];
                   // Roep de read methode van de InputStream aan om de data in de byte array te zetten
                   is.read(b);
                   // Sluit de InputStream
                   is.close();
                   // Sluit de verbinding
                   con.close();
                   // Geef de gebruikersnaam uit de byte array aan het attribuut van gebruiker of geef geen toegang
    /* Testing..... **********************/
                   System.out.println(new String(b));
              catch(Exception e)
                   System.out.println(e.toString());
                   try
                        if(out != null) out.close();
                        if(is != null) is.close();
                        if(con != null) con.close();
                   catch(Exception e2)
                        System.out.println("Exception: " + e2.toString());
              // initialiseer het mainpanel
              mainPanel = new MainPanel();
              // Geef het mainPanel weer
              Display.setCurrent(mainPanel);
    }The data I'm trying to submit does not show up in the $_POST variable in PHP as it should.
    Is there anybody out there who can tell me what I'm doing wrong?

    Hi Antoni, you can delete the 'mx:request' section and pass
    the 'registrationModel' object into the send parameters.
    Code should be:
    <?xml version="1.0" encoding="iso-8859-1"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml">
    <mx:Script>
    <![CDATA[
    import mx.controls.Alert;
    public function submitForm():void {
    formSender.cancel();
    formSender.send(registrationModel);
    //formSender.showBusyCursor = true;
    Alert.show("Your request has been send successfully.", "Send
    Report", Alert.OK , this);
    //resetForm();
    private function getResultOk(r:Number,event:Event):void{
    if(!r){
    Alert.show('Error sending data!!');
    return;
    Alert.show( String(this.formSender.lastResult) );
    ]]>
    </mx:Script>
    <mx:HTTPService id="formSender"
    url="
    http://www.yourdomain.com/mailer.php"
    method="POST" showBusyCursor="true" useProxy="false"
    result="getResultOk(1,event)"
    fault="getResultOk(0,event)" >
    </mx:HTTPService>
    <mx:Model id="registrationModel">
    <firstname>{firstname.text}</firstname>
    <lastname>{lastname.text}</lastname>
    <email>{email.text}</email>
    <position>{position.text}</position>
    </mx:Model>
    <mx:Form width="100%" height="100%">
    <mx:TextInput id="firstname" text="pepe"/>
    <mx:TextInput id="lastname" text="lopez"/>
    <mx:TextInput id="email" text="[email protected]"/>
    <mx:TextInput id="position" text="director"/>
    <mx:Button label="send" click="submitForm()"/>
    </mx:Form>
    </mx:Application>
    And php...
    <?
    echo 'OK: Vars received:'.count($_POST)."\n";
    foreach($_POST as $k=>$v){
    echo $k.'='.$v."\n";
    exit;
    ?>

  • Using LoadVars in SSAS to send data to a php file

    I am using FMS 4.5 and have a simple application which I want to use to send two strings to a php file. But I get a compilation error whenever I try to assign any value to these objects:
    Here is main.asc:
    <code>
    var variables = new LoadVars();
    variables.username = "uname";
    variables.send(http://url.abc.com/test.php,POST)
    </code>
    I can't compile with the second line. FMS just says: Sending error message: Compilation error
    How do I send variables to a HTTP URL?

    However that should be fine..
    This is sample way to send data using LoadVars
    var my_lv = new LoadVars();
    my_lv.name= "myname";
    my_lv.send("http://server/test.php", "_blank", "POST");
    Try keeping url and and POST method within "quotes". Also, method [POST/GET] is third parameter, second is target where results must be loaded (if any)..

  • How can I send multiple string commands into a VISA write?

    Hi Fellow LabVIEW users
    I am very new to LabVIEW (2.5 months) so please forgive me if my lingo is not up to par.
    How can I send multiple string commands to a VISA write. For example each string command looks like this
    1) 3A00 0000 0000 FFFF FFFF FFFF 0000 0000 FF00 0000 0000 0000 0000 0033 (Scenario 1)
    2) 3A01 0000 0000 FFFF FFFF FFFF 0000 0000 FF00 0000 0000 0000 0000 0034 (Scenario 2)
    3) 3A01 0000 0000 33FF FFFF FFFF 0000 0000 FF00 0000 0000 0000 0000 0067 (Scenario 3).
    and so on and so forth. And there are a number of scenarios.
    Each String scenario will give a different string output which will be interpreted differently in the front panel.
    Right now I have to manually change the string commands on the front panel to give me the desired output. How can I do this without manually changing the commands i.e. hard coding each scenario into the block diagram?
    Thanks, any feedback will help.
    mhaque

    Please stick to your original post.

  • Sending a string over ethernet at 1 Hz.

    I am trying to send a string file at 10 Hz over ethnet to another PC. It is a motion file.  I am enclosing a snippet of the file below.
    START_TIME,24-OCT-2004 16:44:54,0 00:02:21
    00:00:00,INIT_POS,v1_m1,33.7487,-118.035,16.97
    AR
    RU
    00:00:00,mot,v1_m1,-2495192.9594000001,-4685876.5558000002,3523316.4575999998,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    00:00:00.100,mot,v1_m1,-2495192.9594000001,-4685876.5558000002,3523316.4575999998,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    00:00:00.200,mot,v1_m1,-2495192.9594000001,-4685876.5558000002,3523316.4575999998,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    00:00:00.300,mot,v1_m1,-2495192.9594000001,-4685876.5558000002,3523316.4575999998,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    00:00:00.400,EN,0,0

    Do you have a question related to this?

  • How to send an entire HTML, PHP dynamic page using phpmail()?

    How to send an entire HTML, PHP dynamic page using phpmail()
    from PHP website, similar to mail this page or send to a friend
    link?

    Hello,
    Please change the mail address
    "info[at]furkids[dot]co[dot]za" from this thread ^^^look above^^^
    to "[email protected]"
    Thank you

  • How to send a String to a Servlet using a HTTP POST

    Well, I have designed a servlet that receives a HTTP POST, I was testing it using an HTML form to send (using POST) information, now, I have coded a Java App to send it a string, I don't know how to make the servlet recognize that info so it can make its work, I am posting both codes (Servlet & API) so anyone can guide me and tell me how and where to modify them
    Servlet:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.sql.*;
    public class xmlwriter extends HttpServlet
    public void service(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException
    ServletOutputStream salida = res.getOutputStream();
    res.setContentType("text/HTML");
    String cadena = req.getParameter("cadena");
    File f1 = new File ("c:/salida.xml");
    FileWriter out = new FileWriter(f1);
    f1.createNewFile();
    out.write(cadena);
    out.close();
    salida.println("OK");
    Now, the JAVA API is:
    import java.io.*;
    import java.net.*;
    public class HTTPSender {
    public static void main(String[] args) throws Exception {
    URL url1 = new URL
    ("http://localhost:8080/XMLSender/xmlwriter");//internal site
    URLConnection UrlConnObj1 = url1.openConnection();
    HttpURLConnection huc1 = (HttpURLConnection)UrlConnObj1;
    huc1.setRequestMethod("POST");
    huc1.setDoOutput(true);
    huc1.setDoInput(true);
    huc1.setUseCaches(false);
    huc1.setDefaultUseCaches(false);
    String cadena = ""
    + "<root>\n"
    + "<tlf>$TLF$</tlf>\n"
    + "<op>$OP$</op>\n"
    + "<sc>$SC$</sc>\n"
    + "<body>$BODY$</body>\n"
    + "</root>";
         PrintWriter out = new PrintWriter(huc1.getOutputStream());
    System.out.println("string="+cadena);
    out.write(cadena);
    out.close();
    I'm a JAVA newbie, so, maybe I'm getting a bad idea of what I need to do, anyway, every (detailed) help is welcome. What my servlet should do (and it doesn't when I send the message through the API) is to write a file with the info received.

    I'm not trying to send a string from a WEB Page, I'm tryring to send it using a JAVA program, I mean, using a HTTPSender, in fact, I already have made the code to do that:
    import java.io.*;
    import java.net.*;
    public class HTTPSender {
    public static void main(String[] args) throws Exception {
    try {
    String cadena = "Message to be written";
    // Send data
    URL url = new URL("http://localhost:8080/XMLSender/xmlwriter");
    URLConnection conn = url.openConnection();
    conn.setDoOutput(true);
    OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
    wr.write(cadena);
    wr.flush();
    // Get the response
    BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
    String line;
    while ((line = rd.readLine()) != null) {
    // Process line...
    wr.close();
    rd.close();
    } catch (Exception e) {
    And modified my servlet so it can receive anything:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.sql.*;
    public class xmlwriter extends HttpServlet
    public void service(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException
    ServletOutputStream salida = res.getOutputStream();
    res.setContentType("text/HTML");
    String cadena = req.toString();
    File f1 = new File ("c:/salida.xml");
    FileWriter out = new FileWriter(f1);
    f1.createNewFile();
    out.write(cadena);
    out.close();
    salida.println("OK");
    Now the problem is that, the servlet in fact DOES create the file, but....the file is empty, that means that no info is arriving to the servlet, why?, how should I send it then? I repeat FORGET about a Web Page Form, that is in the past and I don't need that.

  • How to send a string from sender to receiver side using java

    I am doing a project on Digital Signature.I have already done with the GUI using java swing.
    Now i want to send a string from the sender side to the receiver side on the click of a button using socket programming.
    Please can anybody provide me with the code as early as possible.

    http://catb.org/~esr/faqs/smart-questions.html

  • HTTP transport error: javax.xml.soap.SOAPException: java.security.PrivilegedActionException: javax.xml.soap.SOAPException: Message send failed: String index out of range: -7

    All -
    I'm new to consuming web services in JDeveloper. I'm using Oracle JDEV 10.1.3.3/OC4J.  I'm using this version since it is compatible with Oracle EBS 12.1.3.  My intent is to pull data from our third party recruitment app (Success Factors) and load that data into Oracle HRIS.  I'm already doing this through a .NET application.  I'm converting it to be a Java Concurrent Program in EBS.  The code listed below is a stub call to verify I'm on the right track. I created a JDeveloper Web Services proxy project.  I'm testing it locally on my windows desktop.  When I'm able to consume the service successfully, then I'll think about moving it to the EBS server.
    I'm getting the following error when I invoke the following service:
    HTTP transport error: javax.xml.soap.SOAPException: java.security.PrivilegedActionException: javax.xml.soap.SOAPException: Message send failed: String index out of range: -7
    End point is: https://api4.successfactors.com/sfapi/v1/soap?wsdl
    Any help/assistance would be much appreciated. 
    Below is my code and output of my test:
    package emsc.oracle.apps.emscper.sfapi.proxy;
    import HTTPClient.HTTPConnection;
    import emsc.oracle.apps.emscper.sfapi.proxy.types.sfobject_sfapi_successfactors_com.IsValidSession;
    import emsc.oracle.apps.emscper.sfapi.proxy.types.sfobject_sfapi_successfactors_com.IsValidSessionResponse;
    import emsc.oracle.apps.emscper.sfapi.proxy.types.sfobject_sfapi_successfactors_com.Login;
    import emsc.oracle.apps.emscper.sfapi.proxy.types.sfobject_sfapi_successfactors_com.LoginResponse;
    import emsc.oracle.apps.emscper.sfapi.proxy.types.sfobject_sfapi_successfactors_com.LoginResult;
    import emsc.oracle.apps.emscper.sfapi.proxy.types.sfobject_sfapi_successfactors_com.Logout;
    import emsc.oracle.apps.emscper.sfapi.proxy.types.sfobject_sfapi_successfactors_com.LogoutResponse;
    import emsc.oracle.apps.emscper.sfapi.proxy.types.sfobject_sfapi_successfactors_com.SFCredential;
    import emsc.oracle.apps.emscper.sfapi.proxy.types.sfobject_sfapi_successfactors_com.SFParameter;
    import emsc.oracle.apps.emscper.sfapi.proxy.types.sfobject_sfapi_successfactors_com.Error;
    import java.io.File;
    import javax.xml.rpc.ServiceFactory;
    import java.util.ArrayList;
    import java.util.List;
    import java.util.Date;
    import javax.xml.ws.BindingProvider;
    import javax.xml.soap.SOAPException;
    import java.util.Map;
    import oracle.security.ssl.OracleSSLCredential;
    public class SFAPITest {
        // Declare members:      
        private String companyId;
        private String userName;
        private String password;
        private String developerKey;
        private Date   effDt;
        private String greaterThanEffDt;
        private String lessThanEffDt;
        // Declare constants:      
        final static private String breakLine = "+---------------------------------------------------------------------------+";
        final static private String format    = "yyyy-mm-dd";      
        private enum ReqId {
            PrimaryReq(25),
            PrimaryReqCEO(26),
            EmCarePrimary(27),
            RTI(28),
            EmCareClinical(29);
            private int reqId; 
            private ReqId() {
            private ReqId(int value) {
                reqId = value;
            public int getReqId() {
                return reqId;
        // Getters and Setters:  
        protected String getCompanyId() {
           return this.companyId;
        protected void setCompanyId(String value) {
           this.companyId = value;                 
        protected String getUserName() {
           return this.userName;
        protected void setUserName(String value) {
           this.userName = value;                 
        protected String getPassword() {
           return this.password;
        protected void setPassword(String value) {
           this.password = value;                 
        protected String getDeveloperKey() {
           return this.developerKey;
        protected void setDeveloperKey(String value) {
           this.developerKey = value;                 
        protected Date getEffDt() {
            return this.effDt;
        protected void setEffDt(Date value) {
            this.effDt = value;                 
        protected String getGreaterThanEffDt() {
           return this.greaterThanEffDt;
        protected void setGreaterThanEffDt(String value) {
           this.greaterThanEffDt = value;                 
        protected String getLessThanEffDt() {
           return this.lessThanEffDt;
        protected void setLessThanEffDt(String value) {
           this.lessThanEffDt = value;                 
        public void runProgram()
            SFAPIService mySFAPIService;
            String CompletionText = "";
            String effDtStr2 = null;
        /* Code your program logic here.
        * Use getJDBCConnection method to get the connection object for any
        * JDBC operations.
        * Use CpContext provided commit,rollback methods to commit/rollback
        * data base transactions.
        * Don't forget to release the connection before returning from this
        * method.
        /* Call setCompletion method to set the request completion status and
        * completion text.
        * Status values are ReqCompletion.NORMAL,ReqCompletion.WARNING,
        * ReqCompletion.ERROR.
        * Use Completion text message of length 240 characters. If it is more
        * than 240 then full string will appear in log file and truncated 240
        * characters will be used as request completion text.
        try
            ServiceFactory factory = ServiceFactory.newInstance();
            mySFAPIService = (emsc.oracle.apps.emscper.sfapi.proxy.SFAPIService)factory.loadService(emsc.oracle.apps.emscper.sfapi.proxy.SFAPIService.class);      
            SFAPI api = mySFAPIService.getSFAPI();
           /// SFAPI api = new SFAPI();
            //Map<String, Object> requestContext = ((BindingProvider) api).getRequestContext();
            //requestContext.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);
            System.out.println("ServiceName => " + mySFAPIService.getServiceName().toString());
            System.out.println("End Point   => " + mySFAPIService.getServiceName().toString());
            System.out.println(breakLine);
            // Authentication: Login to SFAPI:
            SFCredential credential = new SFCredential();
            // Fake credentials being passed in for this post:   
            credential.setCompanyId("XXX");
            credential.setUsername("XXX");
            credential.setPassword("XXX");
            credential.setDeveloperKey("XXX");
            HTTPConnection httpsConnection = null;       
            OracleSSLCredential _credential = new OracleSSLCredential();      
            _credential.setWallet("\\\\\\C:\\Program Files\\Java\\jdk1.6.0_33\\jre\\lib\\security", "ParkEstes3");
            /*System.setProperty("javax.net.ssl.trustStore","C:\\\\\OraHome_1\\jdev\\jdevbin\\jdk\\jre\\lib\\security\\keystore");
            System.setProperty("javax.net.ssl.trustStorePassword","changeit");  
            System.out.println(System.getProperty("javax.net.ssl.trustStore"));*/
            // SFParameter: Define a generic SFParameter List.  This is a necessary parameter
            // to invoking calls in SFAPI:      
             /*System.setProperty("javax.net.ssl.keyStore",
             "file:\\\C:\\jdk1.4.1\\jre\\lib\\security\\client.keystore");
             System.setProperty("javax.net.ssl.keyStorePassword","welcome");         */
            /*  System.setProperty("oracle.net.wallet_location",
                          "(SOURCE=(METHOD=file)(METHOD_DATA=(DIRECTORY=\\\C:\Users\dparrish\Oracle\WALLETS)))");  // (2)                     */
            File kstore = new File("C:\\OraHome_1\\jdev\\jdevbin\\jdk\\jre\\lib\\security\\jssecacerts");
            boolean exists = kstore.exists();
            if (!exists) {
                System.out.println("Keystore does not exist");
            else {
                System.out.println("Keystore does exist");
            System.setProperty("javax.net.ssl.trustStore", kstore.getAbsolutePath());
            System.setProperty("javax.net.ssl.trustStorePassword", "changeit");
            //System.setProperty("proxySet", "false");
            //System.setProperty("http.proxyHost", "127.0.0.1");
            //System.setProperty("http.proxyPort", "8080");
            System.out.println(kstore.getAbsolutePath());
            List<SFParameter> lst = new ArrayList<SFParameter>();
            SFParameter param = new SFParameter();
            param.setName("");
            param.setValue("");
            lst.add(param);      
            SFParameter[] sfParam = lst.toArray(new SFParameter[lst.size()]);
            Login login = new Login();
            try {
                login.setCredential(credential);
                System.out.println("1");
                login.setParam(sfParam);
                System.out.println("2");
                LoginResponse loginResponse = new  LoginResponse();
                LoginResult loginResult = new LoginResult();
                try {
                     loginResponse = api.login(login);               
                catch (Exception e ) {
                    System.out.println(e.getMessage());
                System.out.println("3");
                try {               
                     loginResult = loginResponse.getResult();
                catch (Exception e ) {
                    System.out.println(e.getMessage());
                System.out.println("4");
                IsValidSession vs = new IsValidSession();                  
                IsValidSessionResponse isValidSessionResponse = api.isValidSession(vs);
                System.out.println("5");
                if (isValidSessionResponse.isResult()) {
                     System.out.println("Session is valid");
                     System.out.println("Result => " + loginResult.getSessionId());
                     System.out.println(breakLine);              
                    Logout logout = new Logout();
                    LogoutResponse logoutResponse = api.logout(logout);
                    if (logoutResponse.isResult()) {
                         System.out.println("Logout of SFAPI Successful");
                    else {
                        System.out.println("Logout of SFAPI Unsuccessful");
                else {
                     System.out.println("Session is invalid");
                    List<Error> errors = new ArrayList<Error>();
                    for (int i = 0; i < loginResult.getError().length;  i++) {
                        errors.add(loginResult.getError()[i]);
                    for (int i = 0; i < errors.size(); i++) {
                         System.out.println("Error Indice   => " + i);
                         System.out.println("Error Code:    => " + errors.get(i).getErrorCode());
                         System.out.println("Error Message: => " + errors.get(i).getErrorMessage());
                         System.out.println(breakLine);                                                          
                    } // end for loop of SFObject errors
                } // end InvalidSession
            catch (Exception e)
                 System.out.println("Session Credential Exception");
                 System.out.println("Exception => " + e.getMessage());
                 System.out.println(breakLine);                   
        catch (Exception e)
            System.out.println("Parameter List Exception");
            System.out.println("Exception => " + e.getMessage());
            System.out.println(breakLine);
        }   // end runProgram
        // Constructor:
        public SFAPITest()  {
        } // end constructor
        public static void main (String args[]) {
            try
                SFAPITest test = new SFAPITest();        
                test.runProgram();
            catch (Exception e) {
                System.out.println("main exception => " + e.getMessage());
    } // SFAPITest
    Here is the output with trace:
    WARNING: Unable to connect to URL: https://api4.successfactors.com:443/sfapi/v1/soap due to java.security.PrivilegedActionException: javax.xml.soap.SOAPException: Message send failed: String index out of range: -7
    Session Credential Exception
    Exception => ; nested exception is:
        HTTP transport error: javax.xml.soap.SOAPException: java.security.PrivilegedActionException: javax.xml.soap.SOAPException: Message send failed: String index out of range: -7
    +---------------------------------------------------------------------------+
    Process exited with exit code 0.

    The other end is throwing back a programming error.
    That might be because you are sending incorrect data and the other end fails to validate it.
    You might be able to guess based on your C# code.  But, since you are using soap one generic solution is available to you.
    - Get an http proxy interceptor like wireshark.
    - Run it while your C# app runs, collect the http requests from that.
    - Run it while running your java code, collect the http requests from that.
    Compare the two.

  • How to send a string thru UDP

    How can I send a string like this thru UDP:
    0x01 0x40 0x43 0x51
    Can I write it like this:
    data= 0x01, 0x40, 0x43, 0x51;
    Any help, please?

         InputStream in = null;
         HttpURLConnection urlConn =  null;
         int returnCode = 0;   
         try {
               URL url = new URL(URLEncoder.encode(urlStr));
               //Where urlStr is in the form "http://localhost/servlet/myServlet?param1=STRING TO BE PASSED"
              //Create the connection to the servlet url
               urlConn = (HttpURLConnection)url.openConnection();
               urlConn.setDoInput(true);
               urlConn.setDoOutput(true);
               urlConn.setUseCaches(false);
               urlConn.setRequestMethod("GET");
               urlConn.setRequestProperty("Accept-Language", "en");
               urlConn.setRequestProperty("content-type", "text/xml");
               in = urlConn.getInputStream();
               //Put code to read return string here
              } catch (Exception e) { System.out.println("Error : " + e); }
              urlConn.disconnect();

  • Sending novell command from PHP

    Hi,
    I am trying to unzip a file from php.
    I am trying to run a unzip command from phpm but the novell server won't take it.
    when i do: <?php exec("unzip DATA1:/zipfile.zip"); ?>
    i get: unable to find load file SYS:/TMP/UNZIP
    when i do: <?php exec("echo unzip DATA1:/zipfile.zip"); ?>
    i get: unable to find load file SYS:/TMP/ECHO
    when i do: <?php exec("echo unzip "); ?>
    i get: unzip.nlm load status KenelOnly
    Does someone know how to send a command from php to Novell correctly??
    Thank you,

    Have you tried specifying the path with something like
    <?php exec("sys:/system/unzip DATA1:/zipfile.zip"); ?>
    Wolfgang
    "Flex Travel - Higo Rocha Cidario" <[email protected]> wrote in message
    news:oE0uh.7409$[email protected]..
    > Hi,
    >
    > I am trying to unzip a file from php.
    > I am trying to run a unzip command from phpm but the novell server won't
    > take it.
    >
    > when i do: <?php exec("unzip DATA1:/zipfile.zip"); ?>
    > i get: unable to find load file SYS:/TMP/UNZIP
    >
    > when i do: <?php exec("echo unzip DATA1:/zipfile.zip"); ?>
    > i get: unable to find load file SYS:/TMP/ECHO
    >
    > when i do: <?php exec("echo unzip "); ?>
    > i get: unzip.nlm load status KenelOnly
    >
    > Does someone know how to send a command from php to Novell correctly??
    >
    > Thank you,
    >

  • Send multiple strings over TCP - Like messenger service

    Hello all Java Coders,
    I'm new with TCP programming.
    I'm beggining to learn about TCP and sockets connections in Java. In order to achieve this, I was coding a mini-program so I can learn a little bit about this.
    I'm trying to make a simple TCP program.
    The server sends a string to a client...
    I already searched for a couple of hours in google and so on, about what I'm doing wrong.
    [The server code (Just click)|http://pastebin.com/m39fd1273]
    [The client code (Just click)|http://pastebin.com/m57471803]
    I hope that someone can help me with this and, if you have patience, please tell me the reasons my code doesn't work.
    Many thanks,
    Freiheitpt
    P.S.: I think that the problem is on the server side...

    Sorry jverd.
    I was just trying to put things organized.
    Well, I can't get the String to be sent to the client.
    No error occurs.
    Server:
           try {
                srvr = new ServerSocket(1234);
                System.out.println("Connecting...");
                skt = srvr.accept();
                System.out.println("Connected!\nPreparing data exchange...");
                stream = skt.getOutputStream();
                out = new PrintWriter(stream, true);
                System.out.println("Done!\nReady to Send!");
            } catch (IOException ex) {
                System.out.println("Ups, didn't work!");
                System.exit(1);
            while(!data.equalsIgnoreCase("end")) {
                System.out.print("String to send: ");
                data = input.nextLine();
                System.out.print("Sending string: '" + data + "'\n");
                out.print(data);
            }Client:
            try {
                skt = new Socket("localhost", 1234);
                System.out.println("Connecting...");
                if (skt.isConnected()) {
                    System.out.println("Connected!\nPreparing data exchange...");
                    stream = skt.getInputStream();
                    inputStream = new InputStreamReader(stream);
                    in = new BufferedReader(inputStream);
                    System.out.println("Done!\nReady to Receive!");
                } else {
                    System.out.println("Server not available!\nExiting...");
                    skt.close();
                    System.exit(1);
            } catch (IOException ex) {
                System.out.println("Ups, didn't work!");
                System.exit(1);
            while (!data.equalsIgnoreCase("end")) {
                while(!in.ready()) {}
                data = in.readLine();
                System.out.println("Received String: '" + data + "'");
            }

  • Send large string between servlets in different domain

    Hi,
    I need to send a large string from servlet in an web application to a
    servlet in another web application. Those two application are in
    different domains. I can't send the string as request parameter,
    bacause string is too large. I can't send as request attribute either,
    because attribute will lost during redirect to another domain.
    Any solutions? Thanks for any help.

    do set/getAttribute at the ServletContext level which is unique for a particular webapplication. from 1st application u can access the 2nd one using , getServletConfig().getServletContext().getContext("/uripath") which gives you the ServletContext handle of the other application and you can do getAttribute of this.
    Rgds
    Padmanava

  • Send a string to a server

    Hi,
    I am going to write a java application that sends a string so a server. I don�t know what is on the server side(someone else has written the server part) just that my program is going to use sockets and what port number and IP the server has. I first start using datagrampackets but then I have to use byte array that would not work if the server just want a string ?? What should I use?
    /Thanks in advance

    Hi,
    your question is not clear... you can convert the byte array to a string by calling toString method on the byte array.. since the server port and IP is known, try amking a socket and send a string and see what happens by opening a socket inputstream.. read from the stream to understand what the server does..
    - Bibin.

  • Sending a string across a network

    hi java friends!
    i am a pretty good programmer but i know nothing about java and networking
    for a final project for AP Computer science i would like to make a network gamed. If i can get the basic code for sending a string across the network i can figure out the rest.
    SOOOOOOO
    my question is, can someone give me the code, or at least point me on the way to sending a string across a network?
    Thanks

    See http://java.sun.com/docs/books/tutorial/networking/index.html

Maybe you are looking for

  • SAP Standard ABAP Proxy for PO 855 SRM-R/3

    Hi : 855 PO Confirmation in R/3 from SRM Can I use the ABAP Proxy "PurchaseOrderConfirmation_In" to Confirm the PO response in SRM from R/3 ( In R/3 i get a idoc formatted file as 855 from vendor and can do PO Confirmation uisng custom program in R/3

  • Not able to see the added Used DC webdynpro compoent in used Webdynpro Comp

    Hi All, I have three DC's, A,B,C I have declared as B and C components as public parts, I have have added the B,C as used DC's in A dc. Now i tried add B as used webdynpro component in A dc, by using "used Webdynpro Component". I am able to  add B as

  • Inserting images into Word from Photo

    I want to insert photos into a Word Document.  In the past, I would choose Insert>photo from Word, and iPhoto images were available.  Now with Yosemite 10.10.3, iPhoto has been replaced by Photo.  iPhoto images are not available when choosing Insert

  • Imac 10.7.4 version problems

    Having trouble with recently purchased imac.  Very glitchy screen, erratic screen movments, doc icons blurring when highlighted wuth curser.  Purchased in nov. 2011, i have already re-installed the operating system and it seemed to initially solve th

  • Language and input support blackberry

    Hi, I've reloaded the BlackBerry OS 5.0.0.676 on my Pearl 9100, now when i go to the language and input support blackberry I only see english, so I went back to the App Loader and tried instaling diferent languages from there, but I only see the opti