function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Lokeswara ReddyLokeswara Reddy 

Unable to tunnel through proxy. Proxy returns "HTTP/1.0 403 Forbidden

Hi,
Need help in udnerstanding the error type and resolving the same.​
System.CalloutException: IO Exception: Unable to tunnel through proxy. Proxy returns "HTTP/1.0 403 Forbidden

We are trying to integrate with Perlchain CPQ machine, There is no provision for passing the user name and password in the wsdl provided by CPQ. I have followed the link and tweaked to pass these two as part of header.
http://blog.dacology.com/callouts-from-salesforce-adding-soap-headers-for-wsse-security/

I'm still getting the error, 
System.CalloutException: IO Exception: Unable to tunnel through proxy. Proxy returns "HTTP/1.0 403 Forbidden

Need help in resolving this.

//Generated by wsdl2apex

public class xsServicesOp {

        public class Security {
            public UsernameToken usernameToken;
            private String[] usernameToken_type_info = new String[]{'UsernameToken','http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd','UsernameToken','0','1','true'};
            private String[] apex_schema_type_info = new String[]{'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd','true','false'};
            private String[] field_order_type_info = new String[]{'usernameToken'};
        }
        public class UsernameToken {
            public String username;
            public String password;
            private String[] username_type_info = new String[]{'Username','http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd','string','0','1','true'};
            private String[] password_type_info = new String[]{'Password','http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd','string','1','1','true'};
            private String[] apex_schema_type_info = new String[]{'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd','true','false'};
            private String[] field_order_type_info = new String[]{'username','password'};
        }  
    public class CreateOpportunityPortType {
        public String endpoint_x = //'http://localhost:8010/CreateOpptyMed/1';
           (I have replace endpoint with the correct url)
                                    
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCertName_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public Integer timeout_x;
            //instantiate the header
            public UsernameToken userToken;
            public Security Header;
            private String Header_hns = 'Security=http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd';
            //end
        private String[] ns_map_type_info = new String[]{'http://www.test.machine/messages/opportunity/1', 'CdmMessagesOpport', 'http://www.test.machine/opportunity/1', 'CdmOpportunity', 'http://www.test.machine/services/opportunity/1', 'CdmServicesOpport', 'http://www.test.machine/common/1', 'CdmCommon', 'urn:codelist:ISO639-2-2002', 'CdmCodelist', 'http://www.test.machine/customer/1', 'CdmCustomer'};
        public CdmMessagesOpport.CreateOpportunityResponseMessageType CreateOpportunity(CdmOpportunity.OpportunityType Opportunity,CdmOpportunity.AccountType Account,CdmOpportunity.ProductsType[] Products) {
            CdmMessagesOpport.CreateOpportunityRequestMessageType request_x = new CdmMessagesOpport.CreateOpportunityRequestMessageType();
            request_x.Opportunity = Opportunity;
            request_x.Account = Account;
            request_x.Products = Products;
            CdmMessagesOpport.CreateOpportunityResponseMessageType response_x;
            Map<String, CdmMessagesOpport.CreateOpportunityResponseMessageType> response_map_x = new Map<String, CdmMessagesOpport.CreateOpportunityResponseMessageType>();
            response_map_x.put('response_x', response_x);
            
            userToken = new UsernameToken();
            userToken.username = 'onecanon';
            userToken.password = 'password';


            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              '',
              'http://www.test.machine/services/opportunity/1',
              'CreateOpportunityRequestMessage',
              'http://www.test.machine/services/opportunity/1',
              'CreateOpportunityResponseMessage',
              'CdmMessagesOpport.CreateOpportunityResponseMessageType'}
            );
            response_x = response_map_x.get('response_x');
            return response_x;
        }
    }
}

 
Best Answer chosen by Lokeswara Reddy
Lokeswara ReddyLokeswara Reddy
The issue was due to some setup issue on the middle wear, security feature was eanbled on middle wear where it was checking for certification in SFDC request, as the certificate was not included in the request it failed with the above error.
The issue got resolved when the middle wear disabled certificate feature.

All Answers

NagaNaga (Salesforce Developers) 
Hi Lokeswara,

Can you let me know if you are using a pre-release org?
 If so,IP range of the prerelease orgs cannot be set.

Please follow the below link for more info

https://developer.salesforce.com/forums/ForumsMain?id=906F000000093z8IAA

Best Regards
Naga kiran

 
Lokeswara ReddyLokeswara Reddy
@Naga,

I'm using Unlimited Edition, can you please guide me on how to verify whether it is prerelease edition or not?
Amit Chaudhary 8Amit Chaudhary 8
Hi Lokeswara Reddy,

Please add your API class in login user profile (from which user you are calling API).

User-added image

Please let us know if this will help you.
 
Lokeswara ReddyLokeswara Reddy
@Amit,
The user profile has access to the classes
Lokeswara ReddyLokeswara Reddy
The issue was due to some setup issue on the middle wear, security feature was eanbled on middle wear where it was checking for certification in SFDC request, as the certificate was not included in the request it failed with the above error.
The issue got resolved when the middle wear disabled certificate feature.
This was selected as the best answer
ArunaAruna
Hi are you able to solve this problem.

I am also getting same issue when I am trying to send Json file using reset api to external server.

I did setup remote server and I did included endpoint url in the code .
Apart from end point url and remote site settings do I need to any other settings?
Do I need to create any certificate in salesforce and give to external system ?

Can you please help me to resolve this issue ?
 
Lokeswara ReddyLokeswara Reddy
Hi Aruna,

In my case, third party system was expecting a certificate in the reqeust.
It depends on your external server setup, if it demands then you should send certificate in the request, check with your network/server admin to disable certificate feature and test your service, if it works then you have to make necessary changes to pass the cerficate when cerficate feature is enabled again.