Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Calloutcontroller1 {
- public List<consolewrap1> ConsoleWrapperList{get;set;}
- public List<consolewrap1> getperformcallout(){
- ConsoleWrapperList = new List<consolewrap1>();
- HttpRequest req = new HttpRequest();
- HttpResponse res = new HttpResponse();
- Http http = new Http();
- req.setEndpoint('http://************************/sap/opu/odata/SAP/ZORDERS_INFO_SRV/ZORDERN_ETSet');
- req.setMethod('GET');
- String username = '******';
- String password = '*********';
- Blob headerValue = Blob.valueOf(username + ':' + password);
- String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue);
- req.setHeader('Authorization', authorizationHeader);
- req.setHeader('x-csrf-token', 'Fetch');
- req.setHeader('Accept', 'application/json');
- res = http.send(req);
- if(res.getstatusCode() == 200 && res.getbody() != null){
- ConsoleWrapperList=(List<consolewrap1>)json.deserialize(res.getbody(),List<consolewrap1>.class);
- }
- return consolewrapperlist;
- }
- <apex:page controller="Calloutcontroller1" title="JSON table" >
- <apex:form >
- <apex:pageBlock >
- <apex:pageBlockTable value="{!performcallout}" var="wrap" width="100%">
- <apex:column headerValue="Order" value="{!wrap.Orderid}"/>
- <apex:column headerValue="Customer" value="{!wrap.Customerid}"/>
- <apex:column headerValue="Ship via" value="{!wrap.Shipvia}"/>
- <apex:column headerValue="Ship Name" value="{!wrap.Shipname}"/>
- <apex:column headerValue="Ship Address" value="{!wrap.Shipaddress}"/>
- <apex:column headerValue="Ship City" value="{!wrap.Shipcity}"/>
- <apex:column headerValue="Ship Region" value="{!wrap.Shipregion}"/>
- <apex:column headerValue="Returnprd Code" value="{!wrap.Returnprdcode}"/>
- <apex:column headerValue="Returnprd Qty" value="{!wrap.Returnprdqty}"/>
- <apex:column headerValue="Replaceprd Code" value="{!wrap.Replaceprdcode}"/>
- <apex:column headerValue="Replaceprd Qty" value="{!wrap.Replaceprdqty}"/>
- </apex:pageBlockTable>
- </apex:pageBlock>
- </apex:form>
- public class Consolewrap1 {
- public String Orderid{get;set;}
- public String Customerid{get;set;}
- public String Shipvia{get;set;}
- public String Shipname{get;set;}
- public String Shipaddress{get;set;}
- public String Shipcity{get;set;}
- public String Shipregion{get;set;}
- public String Returnprdcode{get;set;}
- public String Returnprdqty{get;set;}
- public String Replaceprdcode{get;set;}
- public String Replaceprdqty{get;set;}
Add Comment
Please, Sign In to add comment