Invoke WebService using Apex ( with/without Authorization) using Apex
Navigation: Setup -> Security Controls -> Remote site Settings
ws.inputHttpHeaders_x = new Map <String, String>();
String b64_string = EncodingUtil.base64Encode(Blob.valueOf('<user_name>:
ws.inputHttpHeaders_x.put('Authorization', 'Basic ' + b64_string);
// donot add this if authentication not need
<li>Successfully authenticated! Now invoke your **webservice methods** as shown</li>
```java
ws.<your_methods_name>(); // pass parameters if method takes arguments
NOTE: if Authorization not needed simply dont add bullet #6.
Summary
So we have learned,
- How to create Remote Site Settings
- Generation of Apex Class from WSDL
- Iniatiation
- Basic Authorization
- webservice methods invoking