Adding SOAP Header to ASP.Net Web Service

Hello All,

In todays age of technology, where data-interchange between systems is imminent. In some cases, it is the application interacting with each other or in some cases it will be the web services interacting with each other.

So, today, we will talk about how to add a SOAP header to your Web Service Call. i.e. if you are trying to call a web service, from your web service and you need to pass a SOAP header to each request you send to that service.

Commonly, web service access credentials are passed along with the service request.

This article assumes, you have a knowledge of:

  1. .Net
  2. Web Services
  3. What is SOAP
  4. How to create a ASP .Net Web Service Project in Visual Studio.

Visual Studio IDE:

  1. Visual Studio 2013

So, lets get started:

Firstly, after your .Net Web Service project is created, right click on the Project name and click Add >> Service Reference

Untitled.png

After you have added the service reference. A pop-up would appear as shown below:

test.png

Enter the Web Service URL that you need to connect to and click Go, to check the connectivity. If successfully connected, then enter the Namespace. In my case, the namespace is ‘ServiceReference’, and then click Ok.

Servicerefernece.png

The service reference will show up under Service References section as shown below:

solution.png

Now, lets open the Web.Config file and edit few things there. As you may see in the screen grab below, a new tag is added into the Web.Config by name name system.serviceModel. It is here that your web service bindings and endpoint details are mentioned.

webconfgig.png

Notice the endpoint tag is closing in-line. Which means, it does not have a separate closing tag

Now, remove the inline closing tag for Endpoint and add a separate closing tag for Endpoint as

webconfgig.png

After you do that, add the below tags in the endpoint tag as shown below:

Webconfig2.png

Now, the headers will be attached with each of your SOAP request.

I hope, this blog helps you with your problem.

-Cheers!

 

 

 

Advertisements

Unable to find a specification for ‘ObjectiveDropboxOfficial’ while pod install

Hello All!

Today, we’ll talk about an error which you will face, while using the DropBox V2 API with Objective-C SDK in XCode.

You can configure the DropBox V2 API, by following the steps in the official GitHub repository of DropBox at https://github.com/dropbox/dropbox-sdk-obj-c.

However, while following the instructions to configure it to your XCode project, you will run into an issue while following to integrate the Dropbox Objective-C SDK into your project using CocoaPods.

It is while running the command pod install after you update the pod file with the below information:

platform :ios, '8.0'
use_frameworks!

target '' do
    pod 'ObjectiveDropboxOfficial'
end

The error that you will face in the terminal is:

: $ pod install

Analyzing dependencies

[!] Unable to find a specification for `ObjectiveDropboxOfficial`

There is a workaround for this, all you need to do is run the following command:

pod repo update

I had run this command in my project directory.

It will take a while (it took a good 30 Mins for me to get my pods updated-so please be patient), for the pod to get updated.

After which run the below command to configure the DropBox SDK to your project. Please make sure that your project is not opened in the XCode.

Below are the statuses while configuring the SDK. It wont take much time to configure the SDK to your project.

Analyzing dependencies

Downloading dependencies

Installing ObjectiveDropboxOfficial (3.0.4)

Generating Pods project

Integrating client project

Once the project is configured, please use xcworkspace file to open the project.

I hope, it works for you all.

Please comment, if necessary.

-Cheers!

Error while installing Cocoapod or any Ruby Gem into OS X El Capitan or Sierra Errno::EPERM

Hello All,

Today, we’ll talk about an error you would be facing while installing a Ruby Gem into your OS X El Capitan or OS X Sierra.

ERROR:  While executing gem … (Errno::EPERM)

This is due to a fact that with OS X El Capitan and Sierra, there is a new security feature called called System Integrity Protection

Well, as I always say, there is always a workaround for your problems. And here is the one for this.

Open your Terminal, and type the below command into your terminal.

sudo gem install -n /usr/local/bin GEM_NAME_HERE

So, if you are going to install Cocoapods then type this command:

sudo gem install -n /usr/local/bin cocoapods

After few seconds, the pod should start installing into your OS X.

-Cheers!