Web service in .NET from Java Web Service

Hi there,

I'm pretty new to .net (although i have years of experience with the old vb 6, access 2k, as well as java)... and need some with perhaps either some syntax or something.

Here is the wsdl.

<wsdl:definitions targetNamespace="http://www.dynix.com/schema/book">


<schema targetNamespace="GetBookInfoByISBN">

<complexType name="BookInfoType">

<element maxOccurs="1" minOccurs="0" name="Title" nillable="true" type="xsd:string"/>
<element maxOccurs="1" minOccurs="0" name="Author" nillable="true" type="xsd:string"/>
<element maxOccurs="1" minOccurs="0" name="ISBN" nillable="true" type="xsd:string"/>
<element maxOccurs="1" minOccurs="0" name="Publisher" nillable="true" type="xsd:string"/>
<element maxOccurs="1" minOccurs="0" name="PublicationDate" nillable="true" type="xsd:string"/>
<element maxOccurs="1" minOccurs="0" name="PublicationPlace" nillable="true" type="xsd:string"/>
<element maxOccurs="1" minOccurs="0" name="Edition" nillable="true" type="xsd:string"/>
<element maxOccurs="1" minOccurs="0" name="Binding" nillable="true" type="xsd:string"/>
<element name="DiscountPrice" type="xsd:double"/>
<element maxOccurs="1" minOccurs="0" name="Availability" nillable="true" type="xsd:string"/>
<element name="ListPrice" type="xsd:double"/>
<element name="DiscountPercent" type="xsd:double"/>

<complexType name="BookInfoResponseType">

<element maxOccurs="1" minOccurs="0" name="Status" nillable="true" type="xsd:string"/>
<element name="BookInfo" nillable="true" type="tns1:BookInfoType"/>
<element maxOccurs="1" minOccurs="0" name="Marc" nillable="true" type="xsd:string"/>

<element name="GetBookInfoByISBN">


<element name="ISBN" type="xsd:string"/>
<element name="CustomerAccount" type="xsd:string"/>
<element name="CustomerSubAccount" type="xsd:string"/>
<element name="LoginName" type="xsd:string"/>
<element name="LoginPassword" type="xsd:string"/>

<element name="GetBookInfoByISBNResponse">


<element name="GetBookInfoByISBNResult" type="tns1:BookInfoResponseType"/>

<wsdl:message name="getBookInfoByISBNResponse">
<wsdl:part element="tns1:GetBookInfoByISBNResponse" name="parameters"/>

<wsdl:message name="getBookInfoByISBNRequest">
<wsdl:part element="tns1:GetBookInfoByISBN" name="parameters"/>

<wsdl:portType name="BookInfoPortType">

<wsdl:operation name="getBookInfoByISBN" parameterOrder="">
<wsdl:input message="impl:getBookInfoByISBNRequest" name="getBookInfoByISBNRequest"/>
<wsdl:output message="impl:getBookInfoByISBNResponse" name="getBookInfoByISBNResponse"/>

<wsdl:binding name="BookInfoPortSoapBinding" type="impl:BookInfoPortType">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

<wsdl:operation name="getBookInfoByISBN">
<wsdlsoap:operation soapAction=""/>

<wsdl:input name="getBookInfoByISBNRequest">
<wsdlsoap:body namespace="GetBookInfoByISBN" use="literal"/>

<wsdl:output name="getBookInfoByISBNResponse">
<wsdlsoap:body namespace="GetBookInfoByISBN" use="literal"/>

<wsdl:service name="BookInfoService">

<wsdl:port binding="impl:BookInfoPortSoapBinding" name="BookInfoPort">
<wsdlsoap:address location="http://localhost/vip/services/BookInfoPort"/>

Basically, I have set up a new web service (done it in both C# and VB), which would then reference this java web reference... but what i need to do is this.

I would like to be able to call this web reference (BookInfoPort), and get the response (BookInfoResponseType) back into .NET.  Once that has been completed, i want to be able to reference the fields that came from this (BookInfoType).

Unfortunately, i got as far as starting the web service but i'm unable to convert the bookinforesponsetype into "bookinfotype".

Here is the method i have written in VB.

    <WebMethod()> _
    Public Function GetBookInfo(ByVal sISBN As String, ByVal sLoginName As String, ByVal sLoginPassword As String) As TechServiceReference.BookInfoType
        Dim myProxy As New TechServiceReference.BookInfoPortTypeClient
        Dim reply As TechServiceReference.BookInfoResponseType
        Dim info As TechServiceReference.BookInfoType

        reply = myProxy.getBookInfoByISBN(sISBN, "", "", sLoginName, sLoginPassword)

        Return reply.BookInfo()
    End Function

Here it is in C#

        public string GetBookInfoByISBN(string ISBN, string loginname, string loginpassword)
            TechBookInfoPortReference.BookInfoPortTypeClient proxy = new TechBookInfoPortReference.BookInfoPortTypeClient();
            TechBookInfoPortReference.BookInfoResponseType reply = null;
            TechBookInfoPortReference.BookInfoType info = null;

            reply = proxy.getBookInfoByISBN(ISBN, "", "", loginname, loginpassword);
            info = reply.BookInfo();

            //Console.WriteLine("Service returned: " + info.ISBN().toString());
            return "test";

The way i've set it up in java, i've been able to "get" the data from BookInfoType, which comes from BookInfoResponseType.

I'm wondering why there is no set/get procedures set up from the wsdl, or am i missing something?

At the moment, i am downloading the WindowsSDK, but need to know if i'm doing this right or not.

 Thanks to anyone who is able to help me out.

12/12/2008 6:49:46 PM
asp.net.xml-web-services 7071 articles. 0 followers. Follow

13 Replies

Similar Articles

[PageSpeed] 50
Get it on Google Play
Get it on Apple App Store

 Alright, i made some further developments, but i'm not sure at this point what is next.

I've located the wsdl program and followed some suggestions on BookInfoPort.  Importing and compiling that information as well.

Next i've modified the Program as follows.

   <WebMethod()> _
    Public Function GetBookInfoByISBN(ByVal strISBN As String, ByVal strLoginName As String, ByVal strLoginPassword As String) As BookInfoType
        Dim myProxy As New BookInfoService
        Dim reply As BookInfoResponseType
        reply = myProxy.getBookInfoByISBN(strISBN, "", "", strLoginName, strLoginPassword)

        Dim info As BookInfoType
        info = reply.BookInfo

        Return info
    End Function

Now, when i run this, i get this error.

System.NullReferenceException: Object reference not set to an instance of an object.

at GetULSBookService.Service1.GetBookInfoByISBN(String strISBN, String strLoginName, String strLoginPassword) in
D:\My Documents\Visual Studio 2008\VB\GetULSBookService\GetULSBookService\Service1.asmx.vb:line 21

I know the error has to do with likely the "info = reply.bookinfo" portion...

I also know that the service does get called as i've checked my logs for the service, and see the service request.

 Any help would be appreciated :)


12/12/2008 11:28:33 PM

I strongly suggest you try single-stepping through this code using the debugger. It may show you that "reply" is not being set.

John Saunders | MVP – Connected System Developer
12/13/2008 9:34:12 PM

Thank you for the response...

I believe i may have figured out the problem...

I changed it around again and decided to make this a "web project" instead.. did the same as above.

This time though, i used fiddler to test the http response and the data shows up correctly

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <GetBookInfoByISBNResponse xmlns="GetBookInfoByISBN">
     <Title>TEST TITLE ONLY</Title>
     <Author>AUTHOR, TEST</Author>
     <Publisher>Test Publisher</Publisher>
     <PublicationDate>2008/12/13 </PublicationDate>
     <Availability>Stocked Item</Availability>

 the problem is that .net is reading it all as null. 

I've gone through a couple of sites that kind of explain how to deal with null returned values... but its a little confusing on what i need to do.  

I checked the namespaces, and they look right to me... So i'm not sure what else i could be missing...

Any thoughts?

12/13/2008 9:54:43 PM

Did you post the exact WSDL? I don't see where the prefix tns1 is defined.

John Saunders | MVP – Connected System Developer
12/13/2008 10:28:20 PM


Did you post the exact WSDL? I don't see where the prefix tns1 is defined.


Yes, that is the full wsdl...

So it sounds like i need to use a different field name for where tns1 is?

12/15/2008 5:08:52 PM

No, the problem is that the WSDL is invalid. Where did it come from?

John Saunders | MVP – Connected System Developer
12/15/2008 6:31:36 PM

Hello John,

The WSDL is created dynamically using ANT, with a few xml files put together... 

Which part is invalid?  I might be able to fix it in some way.

The thing is, i have the above written in a jsp (and java) page, which returns everything correctly.

        BookInfoResponseType reply = null;
        BookInfoType info = null;

            BookInfoServiceLocator bis = new BookInfoServiceLocator();
            BookInfoPortType myProxy = bis.getBookInfoPort(serviceUrl);
            // Get a product by ISBN
            System.out.println("Get Summary by ISBN: " + sISBN + "<br>");
            reply = myProxy.getBookInfoByISBN(
                    sISBN, Account, subAccount, sLoginName, sLoginPassword);

            // Wrapped mode
            String status = reply.getStatus();
            info = reply.getBookInfo();

And this does work currently... 

I appreciate any and all help here.. thank you.

12/15/2008 8:00:34 PM

You really need to run the WSDL through some validation. At the very least, you need to open it in a good XML editor like XMLSpy or the one in IBM Rational Web Developer. It will show you all the errors.

I'll just get you started with a hint: where is the prefix "tns1" defined? For that matter, where is the prefix "wsdl" defined?

John Saunders | MVP – Connected System Developer
12/15/2008 8:09:13 PM

Hmm.. i'm going to venture a guess on how it should look for the wsdl?



12/15/2008 9:24:51 PM

I think you need to reevaluate your method of producing a WSDL. You're going to have more problems than we can count.

For instance, query strings are not permitted in XML namespaces. Also XML namespaces are in the form of a URI but do not need to refer to any resource on the Internet.

One way to get some validation is to open the WSDL in Visual Studio, preferably VS2008. If you don't have it, then download one of the free Express editions. The XML editor is much better in 2008.

Among other things, it will give you plenty of error and warning messages.

John Saunders | MVP – Connected System Developer
12/15/2008 9:44:04 PM

Alright.. so from what i'm getting here, due to the issues in the wsdl, this is the reason i'm having problems with the records being read?  Could there be anything else causing the issue with the data being read?

I am using VS 2008 express and i'll run the wsdl through there and see what else i can find.


12/16/2008 4:19:42 PM

I'm surprised you're able to get anywhere at all with that WSDL. It's really very bad. It doesn't even work as XML, much less as a WSDL.

John Saunders | MVP – Connected System Developer
12/16/2008 4:45:51 PM

I didn't create this wsdl at all.. in fact, part of it is pre-created from a few other xml files, according to ant. 

    <target name="checkWSDL">
        <uptodate property="wsdl.notRequired" targetfile="${gen-src.dir}/com/dynix/www/schema/book/BookInfoService.java">
            <srcfiles dir="${src.dir}/wsdl" includes="book.wsdl"/>

    <target name="wsdl" depends="checkWSDL" unless="wsdl.notRequired">
        <taskdef name="wsdl2java" classname="org.apache.axis.tools.ant.wsdl.Wsdl2javaAntTask" classpathref="project.class.path"/>
        <wsdl2java url="${src.dir}/wsdl/book.wsdl" output="${gen-src.dir}" deployscope="session" skeletonDeploy="no" serverSide="yes" noimports="no" verbose="yes" all="yes" typeMappingVersion="1.1" testcase="no">
            <mapping namespace="GetBookInfoByISBN" package="com.dynix.www.schema.meta"/>

        <!-- Wsdl2Java always generates skeleton implementations, overwrite them -->
        <copy todir="${gen-src.dir}/com/dynix/www/schema/book" overwrite="yes">
            <fileset dir="${src.dir}/wsdl">
                <include name="**/*TestCase.java"/>
                <include name="**/*Impl.java"/>

 So basically, i'd need to go through these files and see what is causing the issue with the wsdl.

12/16/2008 5:26:36 PM

Similar Artilces:

.NET web services Vs Java Web Services
Hello, does anyone know of a book or good source of information that compares .NET and Java Web Services? (I would like soemthing neutral if possible). I am thinking of approaching this subject for my dissertation? Many Thanks Rob Hi Rob, Last year I had to give a powepoint presentation on Web Services. I noticed some good books at barnes and noble that discussed the subject. These books were specific to Java and discussed Web Services in a very clear fashion. They gave some elementary examples that were easy to understand. I have not yet had the pleasure of creatin .NET Web Servi...

How to call a .net web service from another .net web service?
Hi all,I have developed two asp .net web services using visual studio .net 2003.I wish to call one web service from another web service.I tried adding a web reference of the web service in another web service and was able to do so.but i m not able to access the web methods provided by the web servicecould you please suggest a way to go about itExpecting quick replyThanxCharmy try to make sure that you reference it in the web reference and call it properly this is sample  [WebMethod()] public double CalcDistance(int x1, int y1, int x2, int y2) { Calculator.Service1 calc = new...

xml web service --uploading the file to the xml web service
how can we upload the file in the xml web service 1.i mean what will be the return value in the proxy class 2.and how am i going to send the file to the xml web service----regards Bipul Kumar Here are some links to articles that helped us get this done: http://msdn.microsoft.com/webservices http://www.microsoft.com/downloads/details.aspx?familyid=06255a94-2635-4d29-a90c-28b282993a41&displaylang=en https://www.sys-con.com/dotnet/article.cfm?id=458 Hope this helps....

Best Practice for .Net Web Service access to a Web Service on a Test and Production Servers
Hello All, What is the best way to control a .Net web service to be able to access a remote server for testing and then point to another remote server to access the web service in production? Do I need to generate and maintain 2 different proxy objects? TIA, Bob Bob // first create the proxy if not isvalid( i_service) then i_service = create fundtraderproxy_TradeServicesClient_BasicHttpBinding_ITradeServices end if ///You'll see code something like this in the constructor of your proxy //dynamically set the endpoint url with the user supplied value - //r...

How to call .net web service from Java web application?
Hi all,  I have a vb .net web service.How do i call .net web service from Java web application?What all resources I need?Can you please provide a sample application where a java application is invoking methods of .net web service? Thank you Hi, First I am not familiar with java language, but web services are universal operating system and language independent. It doesn't matter where the services is or in what language is written you just invoke it  and it gives you "replay".  Probably you must reffer to java consuming web services.   Regard...

Is web services a part of web Service?
  I have a question: Is web services a part of web server?? And when the client calls web service, it means that client calls web server?? Or is it a different entity in itself which communicates separately both with client and server and acts as middleware application.. I am very confused.. Can someone explain me the architecture...??? Thanks..Dont forget to click "Mark as Answer" on the post that helped you.This credits the member,earns you a point & marks your thread as Resolved so that new users will know where to search for their queries. When you build and dep...

Calling a Web Service from a Web Service
Hello,I was looking for some feedback on calling a web service from within a web service. I've heard that it's not good practice (or not possible). I have a scenario where I think it might make some sense.Within our infrastructure, we've created a web service that handles incoming updates on the statuses of all processes. This has proven to be a good thing since it allows applications to communicate across server to make status updates. It's also used by third party developers and applications to communicate with our infrastructure.Along these lines ... we are planning to create a new compon...

what are web services and what are the advantages of web services?
 Hello  i am new to this .net stuff and i was ask on the job interview what a web services is?and if i did not know given that i had a project ( as a project manager,  or a web developer)   what  is it? how do i start a >NET project on it? what are the main advantages is?  HOW DO I START THIS IN THE INTERVIEW>  and what basic books do i buy?   Hi There, There plenty of source on the net about webservice Definiton: http://en.wikipedia.org/wiki/Web_service http://www.codeproject.com/Purgatory/Defining_Web_Services.asp...

Can you return .net web controls in a .net page from a web service?
I've got a problem with a project. I've got to compile an entire .net page and return it as part of a Web Service for display. The problem I have is that I need to add WebControls and functionality to the page so that not only the html content and images are displayed (which I've managed) but that textboxes, labels, buttons and datasets can be displayed also. Essentially I need to make a call from one site for a page, populate the page and return it in a state as though it resided on the same server/webspace as the calling page. Code is currently built as follows into a string: strOpenHT...

Troubleshoot Web Service; Ajax AutoComplete events do not appear to not fire; Ajax web service appears to not work. .NET
Folks, I had the situation that Ajax AutoComplete events in the web service did not fire after I copied a project out of a folder, renamed it and moved it to a server. The fix was hard to find but easy to solve. I had some web service modules in an ASMX file that provided AutoComplete entries -- i.e., after the user keys in 2 or 3 characters, the list of possible entries with those leading characters is displayed for the user to select. To solve the problem, look at the web service's directive, not the code-behind or the ASMX designer.  Do a right-mouse-click...

Web Site Project: How to configure web service URL in web.config (web service defined in a referenced DLL)
I have a web site that references a business logic DLL project. In the business logic project, there is a web service defined in its app.config file something like this: <applicationSettings>  <MyNamespace.BLL.Properties.Settings>    <setting name="MyNamespace_BLL_MyServer_ServiceName" serializeAs="String">    <value>http://blah.blah.blah.asmx</value>  </setting>  </MyNamespace.BLL.Properties.Settings></applicationSettings> When the web site is published, the web ...

New to web services, why does PB10 web service proxy wizard say there are no services?
here... http://webservices.amazon.com/AWSECommerceService/205-10-05/AWSECommerceService.wsdl oops typo... still doesn't show any services though... http://webservices.amazon.com/AWSECommerceService/2005-10-05/AWSECommerceService.wsdl "Chance" <chance@booklog.com> wrote in message news:43b44cb3$1@forums-1-dub... > here... > > http://webservices.amazon.com/AWSECommerceService/205-10-05/AWSECommerceService.wsdl > Upgraded to 10.2x and now seems to be working...at least it created the proxy. "Chance" <chance@booklog.co...

What action by a web service requires an app to update their web reference to a Web Service
I create a web reference to a web service in my aspx web application which returns an XML object. If the owner of the web service makes a change to their object am I required to do an update web reference? What if I dont use the information from the new object? thanks Larry You should make the change only if the contract b/w the two has changed (e.g. parameters, return values), etc.-Mathew Nolton Website=www.cybral.com Email=mnolton@cybral.com Blog=weblogs.asp.net/mnolton If the web service now returns a new element and my class reference doesn't match their new class ref...

Changing URL in web.config for web service
I added a web reference to asmx file. In web.config - it adds - undefinedadd key="CoreService.CoreServices" value="http://test/CoreServices.asmx I then change it to <add key="CoreService.CoreServices" value="http://test2/CoreServices.asmx"/> But CoreService.CoreServices still looks for http://test/CoreServices.asmx.  What else do i have to change? I think CoreService.CoreServices are hard coded into the source code.  Girijeshhttp://www.girijesh.in/ I think CoreService.CoreServices are hard coded into the source code.  Girijeshhttp://www.girijesh.in/ So no ...

Web resources about - Web service in .NET from Java Web Service - asp.net.xml-web-services

United States Department of Health and Human Services - Wikipedia, the free encyclopedia
The United States Department of Health and Human Services ( HHS ) is a Cabinet department of the United States government with the goal of protecting ...

Pinery Fire: Country Fire Service declares fire is contained as residents confront widespread devastation ...
THE deadly Pinery fire — which has been fully contained — destroyed or severely damaged 87 homes that are now considered uninhabitable, Premier ...

State shuts down Aboriginal children's ear screening service
The state government has cut off funding for a Perth Aboriginal children's ear clinic, despite its rating of 'outstanding' in an independent ...

The capex data has a services blind spot
The latest investment figures overstate the importance of the mining industry and exclude several services sectors that account for half of all ...

Australian Public Service devoid of policy? 'Crap', says MP Stuart Robert
Minister slams comment that federal bureaucracy is a policy-free zone and calls for shared services revolution.

Survivors of Paris terror attacks attend memorial service
PARIS ended a period of mourning for the victims of last fortnight’s terror attacks with a solemn memorial service attended by 1000 survivors ...

Malcolm Turnbull calls a ceasefire in the war on the public service
Malcolm Turnbull is already taking a very different approach than Tony Abbott to the public service.

Amazon shows off prototype drone for future delivery service in new video
... was released on Sunday (and features Top Gear ’s Jeremy Clarkson). The video offers an updated look at what the company’s drone delivery service ...

Volvo launches in-car package delivery service in Gothenburg
Filed under: Volvo , Europe , Technology This Christmas, Santa's reindeer will deliver presents to Volvo owners in Gothenburg, Sweden, as part ...

One-day sale: Get an extra 15% off all VPN services
If you want your private information to stay private and away from the prying eyes of snoops and hackers, getting online with a VPN service is ...

Resources last updated: 11/30/2015 8:09:24 AM