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">
−
<wsdl:types>
−
<schema targetNamespace="GetBookInfoByISBN">
−
<complexType name="BookInfoType">
−
<sequence>
<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"/>
</sequence>
</complexType>
−
<complexType name="BookInfoResponseType">
−
<sequence>
<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"/>
</sequence>
</complexType>
−
<element name="GetBookInfoByISBN">
−
<complexType>
−
<sequence>
<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"/>
</sequence>
</complexType>
</element>
−
<element name="GetBookInfoByISBNResponse">
−
<complexType>
−
<sequence>
<element name="GetBookInfoByISBNResult" type="tns1:BookInfoResponseType"/>
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>
−
<wsdl:message name="getBookInfoByISBNResponse">
<wsdl:part element="tns1:GetBookInfoByISBNResponse" name="parameters"/>
</wsdl:message>
−
<wsdl:message name="getBookInfoByISBNRequest">
<wsdl:part element="tns1:GetBookInfoByISBN" name="parameters"/>
</wsdl:message>
−
<wsdl:portType name="BookInfoPortType">
−
<wsdl:operation name="getBookInfoByISBN" parameterOrder="">
<wsdl:input message="impl:getBookInfoByISBNRequest" name="getBookInfoByISBNRequest"/>
<wsdl:output message="impl:getBookInfoByISBNResponse" name="getBookInfoByISBNResponse"/>
</wsdl:operation>
</wsdl:portType>
−
<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:input>
−
<wsdl:output name="getBookInfoByISBNResponse">
<wsdlsoap:body namespace="GetBookInfoByISBN" use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
−
<wsdl:service name="BookInfoService">
−
<wsdl:port binding="impl:BookInfoPortSoapBinding" name="BookInfoPort">
<wsdlsoap:address location="http://localhost/vip/services/BookInfoPort"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>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 FunctionHere it is in C#
[WebMethod]
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.
![]() |
-1 |
![]() |
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 FunctionNow, 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) inD:\My Documents\Visual Studio 2008\VB\GetULSBookService\GetULSBookService\Service1.asmx.vb:line 21I 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 :)
Thanks.
![]() |
-1 |
![]() |
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
![]() |
1 |
![]() |
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
35c
<?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">
<soapenv:Body>
<GetBookInfoByISBNResponse xmlns="GetBookInfoByISBN">
<GetBookInfoByISBNResult>
<Status>OK</Status>
<BookInfo>
<Title>TEST TITLE ONLY</Title>
<Author>AUTHOR, TEST</Author>
<ISBN>9781111111113</ISBN>
<Publisher>Test Publisher</Publisher>
<PublicationDate>2008/12/13 </PublicationDate>
<Binding>HC</Binding>
<DiscountPrice>125.0</DiscountPrice>
<Availability>Stocked Item</Availability>
<ListPrice>250.0</ListPrice>
<DiscountPercent>0.5</DiscountPercent>
</BookInfo>
</GetBookInfoByISBNResult>
</GetBookInfoByISBNResponse>
</soapenv:Body>
</soapenv:Envelope>
0
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?
![]() |
0 |
![]() |
Did you post the exact WSDL? I don't see where the prefix tns1 is defined.
John Saunders | MVP – Connected System Developer
![]() |
0 |
![]() |
johnwsaunders3:
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?
![]() |
0 |
![]() |
No, the problem is that the WSDL is invalid. Where did it come from?
John Saunders | MVP – Connected System Developer
![]() |
0 |
![]() |
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.
![]() |
0 |
![]() |
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
![]() |
0 |
![]() |
Hmm.. i'm going to venture a guess on how it should look for the wsdl?
targetNamespace="http://localhost/vip/services/BookInfoPort?wsdl"
xmlns:tns="http://localhost/vip/services/BookInfoPort?wsdl"
xmlns:xsd1="http://localhost/vip/BookInfoPort.xsd"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
![]() |
0 |
![]() |
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
![]() |
0 |
![]() |
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.
![]() |
0 |
![]() |
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
![]() |
0 |
![]() |
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"/>
</uptodate>
</target>
<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>
<!-- 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"/>
</fileset>
</copy>
</target>So basically, i'd need to go through these files and see what is causing the issue with the wsdl.
![]() |
0 |
![]() |