• narens
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 7
    Replies

Hello,

 

We are developing an XML listener (service) as a Sites page.

We are using getContent() to obtain the XML content posted (via HTTP POST) without parameters. To be more specific, this is not through a form POST.

 

When I call xmlBody.toString() based on the code below, it returns nothing.

 

VF page Coding

 

<apex:page controller="InboundProcessor" action="{!init}" showHeader="false" sidebar="false"></apex:page>

 

ApexClass Coding

 

public PageReference init() {  
   PageReference xml = new PageReference(ApexPages.currentPage().GetURL());
   Blob xmlBody = xml.getContent();

   System.debug('blobcontent::'+xmlBody);
   System.debug('xmlStringcontent::'+xmlBody.toString());

}

 

Is there any issue with getContent()?

 



Arunraj

Message Edited by Arunraj on 03-22-2010 06:16 AM
Message Edited by Arunraj on 03-22-2010 06:16 AM

We are building an application on the force.com platofrm where we have created a lrge number of custom objects.

 

We are working on creating user documentation (help and training documents)  and would like to override the default link of Help on the top right corner of the page. 

 

Please advise how we can override that. If that is not possible, how can i remove that link. I do not want my users to see the salesforce help as that is not relevant to our app.

Message Edited by MannySIngh on 02-19-2010 01:48 PM

Is anyone using the Eclipse 3.4.2 IDE on Windows 7 64-bit?  Have you seen any problems?

 

Thanks

David

Hello,

 

I have created some apex on a sites page that will receive an XML message from an 3rd party service, parse it, and save a new object. It works fine over HTTP Post, but gives me an "Authorization Required" message when I post to it via HTTPS.

This is in Developer Edition (which means the secure site URL is the same as the non-secure one)

 

Is the issue my XML sender?:

My HTTP posting simulator that I use/created to send XML messages does not make use of the SSL certificate when it posts, so I can't test that. Perhaps it is not receiving the SSL certificate, and so it is refusing access...

Can anyone suggest a tool that would help me test HTTPS posts with a certificate? 

 

Alternatively, how do I post an HTTP message over secure XML? I see that I can build an HTTP request, and populate a parameter with the PKCS12 "key store and password". Where do I get that?

 

Other ideas? Do I have to open up the "salesforce firewall" to receive these 3rd party posts?

 

Thanks

 

Update:

What I learned in this process, is that to debug Sites pages, you should debug them by calling them from within salesforce, authenticated. You will get better error messages.

The SSL didn't seem to be the issue in the end.

Also, salesforce can't receive and parse XML messages at this point, only CGI postings, which it does well.

 

Message Edited by ErikTheTinkerer on 12-03-2009 06:46 AM
Message Edited by ErikTheTinkerer on 12-15-2009 10:45 AM
>>All,
>>
>>Does anyone know if it is at all possible to get access to to the POST data from a visualforce page when posting from another domain. The >>example below works fine for GET but I actually prefer to use POST if at all possible.
>>
>>-Tom
 
Nevermind,
 
I was able to get the POST values using the same technique for GET fields by using.
ApexPages.CurrentPage().getParameters()
 
only caveat is you must post to the true url in my case:
 c.cs2.visual.force.com/apex/mypage
 
luckily the $Page.mypage returns the true url.
 
Sorry about the previous Message,  my sample code seemed to hose the page so I could not reply or remove
(don't use chrome to post messages and paste code).
 
-Tom
 
 
well here is the working code:
 
Code:
<apex:page>
<h1>Wrapper to Punchout Site</h1>
 <br></br><b>Browser Post URL:</b>  {!$Page.testProxy}
 <br></br>
 <apex:iframe src="http://127.0.0.1/fakePunchout/submitPOOM.html" id="Iframe_Punchout"/>
</apex:page>

----------------------------------------------------------------
submitPOOM.html
----------------------------------------------------------------
<html>
<body>
    <h1>DEMO Punchout FORM POST</h1>
    <form action="https://c.cs2.visual.force.com/apex/testProxy" method="POST" target="_top">
  <br/><input type="text" name="cxml-urlencoded" id="payload2" value="POST Entire URL-Encoded PunchOutOrderMessage"/>
        <input type="submit" value="confirm"/>
    </form>
    <br/><br/>

 <h1>DEMO Punchout FORM GET</h1>
    <form action="https://cs2.salesforce.com/apex/testProxy" method="GET" target="_top">
     <br/><input type="text" name="cxml-urlencoded" id="payload3" value="GET Entire URL-Encoded PunchOutOrderMessage"/>
        <input type="submit" value="confirm"/>
    </form>
</body>
</html>
----------------------------------------------------------------
testProxy
----------------------------------------------------------------

<apex:page controller="testProxy" action="{!init}">
  <form>
  <h1>SFDC - DEMO PROCESS POOM</h1> 
  <br></br>
  <textarea name="payload" style="width:500px;height=400px;">{!cxml}</textarea>
  <br></br>
  {!headers}
   <br></br>
  </form>
</apex:page>
----------------------------------------------------------------
public class testProxy {
    public string cxml{get; set;}
    public string headers {get; set;}

    public PageReference init() {
     if ( ApexPages.currentPage().getParameters().get('cxml-urlencoded') != null )
         cxml = ApexPages.currentPage().getParameters().get('cxml-urlencoded');
         
        headers='';
        MAP<string, string> hdrs = ApexPages.currentPage().getheaders();
        for (string key : hdrs.keySet() )
            headers += key + ' : ' + hdrs.get(key) + '\n';
    
        return null;
    }
}

 
 
 


Message Edited by tesii on 01-06-2009 12:35 PM

Message Edited by tesii on 01-06-2009 12:36 PM
Every user record in our SFDC org has a User.Manager listed, except our CEO. SFDC won't allow a circular relationship, and every other user already reports to someone else, so SFDC won't let us list any other user as the CEO's manager (even, say, the CEO's assistant, or the VP of HR).

When using User.Manager to route approvals, this becomes a serious issue. We've implemented Expense Reports in SFDC, and use the Manager hierarchy for automatic routing. Finance is only triggered to pay approved expense reports. Therefore, we'd like the CEO's expense reports to route to our VP of Finance for approval.

We tried putting an inactive user in the CEO's User.Manager field, but it didn't work. When the CEO tries submitting an expense report for approval, SFDC complains that "This approval request requires the next approver to be determined by the Manager field. This value is empty. Please contact your administrator for more information." (Of course, the value isn't "empty," it's pointing to an inactive user.)

Any ideas for how to route approvals for the top of the manager hierarchy, i.e. our CEO?
Is there a recommended approach for the using the API to assign approvers?  Here's our scenario:
 
We have an approval process that requires a manager, vice-president, and president's approval.  So, we have an approval process with three approval steps.
 
The manager and vice-president vary, so the corresponding user ids must be assigned programmatically.  (We cannot use the "Step 3. Select Assigned Approver" option to specify the user who should approve records that enter this step.  We also cannot allow either the submitter or the approving user to manually choose the next user.)
 
What's the recommended approach here?
 
 
  • January 16, 2007
  • Like
  • 0