Consuming Web services with Microsoft .NET
The new Microsoft development platform has a simple and straightforward way to consume webservices.
In the next steps we will see how this is done:
- Start by opening Visual Studio .NET
- Create a Windows Application Project
- Under the Solution Explorer right-click on the solution name and choose Add Web Reference
- Type the address where the web service is located: http://sirius.bn.pt
-
We can choose the option View Contract to look at the web service description
- Add the web reference
- Add controls to the form, to get user input and display the results, and code to execute the services
- See the services description bellow for some code examples
Monitoring
Visual Studio .NET doesn't includes a TCP monitor. The Axis monitor can be used instead or you can download the
Microsoft SOAP Toolkit from http://msdn.microsoft.com and use its Trace Utility.
If you're going to use the Axis monitor see Axis Monitoring.
Using the Microsoft SOAP Toolkit Trace Utility
- Execute the Trace Utility
- Add a new Formated Trace
- In the Trace Setup add the following values:
- Local port # - select a local port to be monitored (example: 9090)
- Destination host - sirius.bn.pt
- Destination port - 80
- Click Ok
- The monitor is ready, now we have to make a small change to the generated code:
-
Open the Reference.vb file which is located in the project directory under Web References\pt.sirius.bn and
change the Me.Url variable value to:
http://localhost:9090/sirius/sirius2.exe
- Now we can see the SOAP request and the service SOAP response
Get Record by ISBN
Input parameters
Output parameters
Search
Input parameters
-
terms - Array of Strings.
Each term identifies the search prefix, matches the corresponding value. See the next term list for details:
- AS - Subject
- AU - Author
- DP - Publishing date
- CDU - Universal Decimal Classification
- ED - Publisher
- COL - Series
- ISBN - ISBN
- TI - Title
- empty term - Word search
-
values - Array of Strings.
The values to search for. Values can be prefixed with logical operators to restrict the search result:
- < - Lower than
- > - Greater than
- = - Equal to
- <= - Lower than or equal to
- >= - Greater than or equal to
- precedences - Array of Integers
-
operators - Array of Strings.
The pairs term-value are linked by the operator wich assumes the values AND, OR and AND NOT
- pagesize - Integer. The number of records by page
- pagenumber - Integer. The page number
Output parameters
- marcXML - Array of MarcXML object
|