Thursday, May 29, 2008

Implementing logic in the proxy and consuming the service in .NET

First the good news :)
I managed to create the service and was able to consume it from .NET.
Here were the open questions from the last post....
1) How to write some logic in the server proxy
2) Where and how to find the wsdl with binding information so that i can consume it from .NET

In order to write the logic into proxy i went to the package in which i generated the proxy. In that package i found that an interface has been generated for the message interface we generated in ESR and a class to implement the interface. I found the method instance method of the class and went ahead editing the method implementation. My first unassisted ABAP code. Here's how it looked like....


OUTPUT-GET_EMPLOYEE_OUTPUT-ID = INPUT-GET_EMPLOYEE_INPUT.
OUTPUT-GET_EMPLOYEE_OUTPUT-NAME-FIRST_NAME = 'Abhishek'.
OUTPUT-GET_EMPLOYEE_OUTPUT-NAME-LAST_NAME = 'Kumar'.


Once done i went to the transaction SOAMANAGER. This is the new transaction which replaces the transactions WSADMIN and WSCONFIG. This opened a webdynpro UI with a tab Business Administration on which there's a link Web Service Administration. There i can search for the design time component i want to configure. (EmployeeService) in my case. Once selecting the service i can go to Configurations tab where i select to Create a Service. I can choose a name for the service and binding. Whatever i choose here appears in the final wsdl as service and binding. Once done I can choose a type of authentication. I chose http authentication. and saved the configuration.

On the same page i found the link to the wsdl with all the binding and port information. On having a look at the wsdl i confirmed that binding and service tags are available.
Copy the link to the wsdl and try setting the reference to this wsdl in Visual Studio. Once done i am able to call the service easily from .NET.

Now the second question which was how to add more then one operation to the Message Interface. This is a limitation in 700 release of BASIS. And unfortunately the sandbox system has a 700 release of BASIS. According to some documentation i found i can add more then 1 operations in the message interface. So i parked it for the time being.....

~Abhishek

PS :- This was my hello world to the world of ABAP. i.e. a first program in ABAP. This post is the last in the series of blogs i started on May 23rd 2008 :)

No comments: