search
Japanese Chinese Nederlands Espanol Italiano Deutsch Francais Twitter Rss Feeds
MicrosoftArticlesForumsFAQs
C# .NET
VB.NET
Visual Studio .NET
ADO.NET
Xml / Xslt
VB 6.0
.NET CF
GDI+
LINQ
Deployment
Security
FoxPro
Silverlight / WPF
Entity Framework
RIA Services

Web ProgrammingArticlesForumsFAQs
JavaScript
ASP
ASP.NET
Web Services

Non-MicrosoftArticlesForumsFAQs
NHibernate
Perl
PHP
Ruby
Java
Linux / Unix
Apple
Open Source

DatabasesArticlesForumsFAQs
SQL Server
Access
Oracle
MySQL
Other Databases

OfficeArticlesForumsFAQs
Excel
Word
Powerpoint
Outlook
Publisher
Money

Operating SystemsArticlesForumsFAQs
Windows 7
Windows Server
Windows Vista
Windows XP
Windows Update
MAC
Linux / UNIX

Server PlatformsArticlesForumsFAQs
BizTalk
Site Server
Exhange Server
IIS

Graphic DesignArticlesForumsFAQs
Macromedia Flash
Adobe PhotoShop
Expression Blend
Expression Design
Expression Web

OtherArticlesForumsFAQs
Subversion / CVS
Ask Dr. Dotnetsky
Active Directory
Networking
Uninstall Virus
Job Openings
Product Reviews
Search Engines
Resumes

 

View Other Visual Studio .NET Posts   Ask New Question 
create a wsdl filel format to interface between a asp.net app and a java app???
abc V posted at Thursday, September 11, 2008 11:51 AM

Hi All,

What kind of service would be preferred for this situation where the .net app should interact and send information to a java application.

<xsd:element name="name" type="xsd:string">

- <xsd:annotation>
  <xsd:documentation>name: Name of the Student:</xsd:documentation>
  </xsd:annotation>
  </xsd:element>
 </xsd:annotation>
 
Thanks a lot in advance.

 
  try this
ram kumar replied to abc V at Thursday, September 11, 2008 1:07 PM

Hi,

This is sample only

 

In the .NET environment, a Web service can be developed using VisualStudio .NET* and can be written in multiple languages, including C#* and Visual Basic .NET. Use of Visual Studio .NET is warranted for development of complicated Web services, but a simple text editor will suffice to create the very simple Web service in this article. For those who prefer it, Visual Studio .NET will also work very well for these examples.

Before you start, please download and install the .NET Framework* if you do not already have it installed. The runtime environment will be automatically added to IIS and will allow you to run a .NET-based Web service on your system.

Create a directory called "phonebook" in the IIS wwwroot directory. Usually this directory is "c:\Inetpub\wwwroot". Next, use a text editor to write the following code and save the file as "GetPhoneInfo.asmx" in this new "phonebook" directory:

 

    <%@ WebService Language="VB" Class="PhoneService"

    %>

    Imports System.Web.Services

    Imports Microsoft.VisualBasic

    Imports System.Data.SqlClient

    Public Class PhoneService Inherits

    System.Web.Services.WebService

       <WebMethod()> Public Function

    GetPhoneNumber ( ByVal strLastName As String, ByVal

    strFirstName As String ) As String

          Dim strConn As String =

    "Pooling=false;server=dbserver01;Database=Northwind;uid=testuser;Password=password;"

 

          Dim SQLConn As New

    SqlConnection(strConn)

          Dim strSQLQuery As String =

    "select HomePhone from Employees where FirstName Like '"

    &strFirstName & "' And

    LastName Like '" & strLastName

    & "'" Dim SQLCmd As New

    SqlCommand(strSQLQuery, SQLConn)

          On Error Resume Next

          SQLConn.Open()

          If Err.Number <> 0

    Then

             return

    "Error connecting to SQL server: " & strConn

    & " " & Err.Number

    & ". Desc: " &

    Err.Description

          End If

          '-------------- execute

    query

          Dim myReader As

    SqlDataReader =

    SQLCmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection)

          While myReader.Read()

             GetPhoneNumber=(myReader.GetString(0))

 

          End While

          If Err.Number <> 0

    Then

             return

    "Error executing SQL query: " & Err.Number

    & ". Desc: " &

    Err.Description

          End If

          myReader.Close()

       End Function

    End Class


Here is a summary of what is happening in the code above:

The first line identifies this class as a Web service. Next, we import the required namespaces that contain the relevant classes for the Web service. Our class called "PhoneService" inherits "System.Web.Services.Webservice."

Define a method called "getPhoneNumber" that will expose the desired functionality of the Web service. Please note the "<WebMethod>" prefix. In this method, the next lines of code open a connection to the SQL* database, "Northwind," and run our SQL queries against the table, "Employees." Use the appropriate SQL server name, user ID, and password with the right privileges.

The code performs a query for an employee record based on first and last names, and subsequently returns the phone number as a result. Errors result in an error string being returned instead of the phone number. This error handling is rudimentary, but it serves our purposes here.


The first phase to developing a Java-based client is to generate the client-side stubs for the Web service we are interested in. We can do that by using a tool provided in the Java WSDP called xrpcc. This tool is available in the <jwsdp_install_dir>\bin directory, and it can generate client-side stubs that internally use JAX-RPC to communicate with the Web service. To use this tool, follow this procedure:


Download and save the Web Services Description Language (WSDL) file for the PhoneService Web service as GetPhoneInfo.xml. You can retrieve the WSDL file for the service we have written by accessing this URL (assuming we are using .NET based Web service running on IIS): http://localhost/phonebook/GetPhoneInfo.asmx?wsdl


The xrpcc tool does not expect service definition files as input; instead, it expects as input the XML configuration file with information about the WSDL file. Now create a file called config.xml that has the following format: <?xml version="1.0" encoding="UTF-8"?>

<configuration

xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">

<wsdl location="GetPhoneInfo.xml"

packageName="phonepackage">

</wsdl>

</configuration>

For the WSDL model, the configuration file specifies two pieces of information:


Line 4 refers to the WSDL file for the PhoneService Web service for which we are developing the client (which we saved earlier). Alternatively, we may decide to specify the location as a URL, which in our case is the following: http://localhost/phonebook/GetPhoneInfo.asmx?wsdl


Line 5 refers to the fully qualified package name to which the client Java classes will belong.

Run the tool with the following command line: C:\source>xrpcc -client -verbose config.xml

You will see the following output:

warning: ignoring port "PhoneServiceHttpGet": no SOAP address specified

warning: ignoring port "PhoneServiceHttpPost": no SOAP address specified

[ServiceInterfaceGenerator: creating service interface: phonepackage.PhoneService]

[ServiceGenerator: creating service: phonepackage.PhoneService_Impl]

[SerializerRegistryGenerator: creating serializer registry:

phonepackage.PhoneService_SerializerRegistry]

[CustomClassGenerator: generating JavaClass for: GetPhoneNumber]

[CustomClassGenerator: wrote file: C:\source\.\phonepackage\GetPhoneNumber.java]

[CustomClassGenerator: generating JavaClass for: GetPhoneNumberResponse]

[CustomClassGenerator: wrote file:

C:\source\.\phonepackage\GetPhoneNumberResponse.java]

[LiteralObjectSerializerGenerator: writing serializer/deserializer for:

GetPhoneNumber]

[LiteralObjectSerializerGenerator: wrote file:

C:\source\.\phonepackage\GetPhoneNumber_LiteralSerializer.java]

[LiteralObjectSerializerGenerator: writing serializer/deserializer for:

GetPhoneNumberResponse]

[LiteralObjectSerializerGenerator: wrote file:

C:\source\.\phonepackage\GetPhoneNumberResponse_LiteralSerializer.java]

[done in 7922 ms]

 
solution
Raj Cool... replied to abc V at Friday, September 12, 2008 2:23 AM

Hi,

You will need to have one xml configuration file for each application and need to specify the protocols and the common ports they used. Please go through the remoting using Xml file. You will also need the build operation like below:

 Call BuildOperation("C:\work\xarea\soap\MathLib\MathLib1\MathLib1.WSDL", "C:\work\soap\MathLib\MathLib1\MathLib1.WSML", "add").Execute()
Call
BuildOperation("C:\work\xarea\soap\MathLib\MathLib2\MathLib2.WSDL", "C:\work\soap\MathLib\MathLib2\MathLib2.WSML", "add").Execute()
 

Please refer http://www.c-sharpcorner.com/UploadFile/ctomescu/WSBNJNCT11232005010552AM/WSBNJNCT.aspx for reference.

-Paresh