chow_cheska
asked on
webservice: problem with enumerated element in xsd class vb.net vs2005
the xsd:
<xs:element name="IndividualUpdateList Response">
<xs:complexType>
<xs:sequence>
<xs:element ref="tns:ResponseRecordAtt ributes" />
<xs:element name="IndividualUpdateList ResponseIt em" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element ref="tns:qts_incident_id" />
<xs:element ref="tns:qts_message_id" />
<xs:element ref="tns:title" />
<xs:element ref="tns:log_date" />
<xs:element ref="tns:isOriginal" />
<xs:element ref="tns:direction" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
the xml
<response systype="success" sysmessage="noerror" sysaction="view_individual update_lis t">
<IndividualUpdateListRespo nse>
<IndividualUpdateListRespo nseItem>
<qts_incident_id>string</q ts_inciden t_id>
<qts_message_id>string</qt s_message_ id>
<title>string</title>
<log_date>string</log_date >
<log_date>string</log_date >
<direction>string</directi on>
</IndividualUpdateListResp onseItem>
<IndividualUpdateListRespo nseItem>
<qts_incident_id>string</q ts_inciden t_id>
<qts_message_id>string</qt s_message_ id>
<title>string</title>
<log_date>string</log_date >
<log_date>string</log_date >
<direction>string</directi on>
</IndividualUpdateListResp onseItem>
</IndividualUpdateListResp onse>
</response>
my problem:
I can't reference IndividualUpdateListRespon seItem through IndividualUpdateListRespon se
I can 't reference qts_incident_id through IndividualUpdateListRespon seItem
I would expect to be able to reference
response.IndividualUpdateL istRespons e.Individu alUpdateLi stResponse Item.qts_i ncident_id
I can't get to elements under IndividualUpdateListRespon seItem ...?
the xsd.exe (vs2005) built IndividualUpdateListRespon seIndividu alUpdateLi stResponse Item but I don't understand how to use it?
do I somehow add IndividualUpdateListRespon seIndividu alUpdateLi stResponse Item to IndividualUpdateListRespon se myself?
I've attached the XSD classes and the build/bind from my dataClass
I need to build the response and build the itemListing by iterating through a datareader.
the dr returns 0 or more rows, 1 IndividualUpdateListRespon seItem is built for each row ...
XSD-classes1-5.vb
DataClass.vb
<xs:element name="IndividualUpdateList
<xs:complexType>
<xs:sequence>
<xs:element ref="tns:ResponseRecordAtt
<xs:element name="IndividualUpdateList
<xs:complexType>
<xs:sequence>
<xs:element ref="tns:qts_incident_id" />
<xs:element ref="tns:qts_message_id" />
<xs:element ref="tns:title" />
<xs:element ref="tns:log_date" />
<xs:element ref="tns:isOriginal" />
<xs:element ref="tns:direction" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
the xml
<response systype="success" sysmessage="noerror" sysaction="view_individual
<IndividualUpdateListRespo
<IndividualUpdateListRespo
<qts_incident_id>string</q
<qts_message_id>string</qt
<title>string</title>
<log_date>string</log_date
<log_date>string</log_date
<direction>string</directi
</IndividualUpdateListResp
<IndividualUpdateListRespo
<qts_incident_id>string</q
<qts_message_id>string</qt
<title>string</title>
<log_date>string</log_date
<log_date>string</log_date
<direction>string</directi
</IndividualUpdateListResp
</IndividualUpdateListResp
</response>
my problem:
I can't reference IndividualUpdateListRespon
I can 't reference qts_incident_id through IndividualUpdateListRespon
I would expect to be able to reference
response.IndividualUpdateL
I can't get to elements under IndividualUpdateListRespon
the xsd.exe (vs2005) built IndividualUpdateListRespon
do I somehow add IndividualUpdateListRespon
I've attached the XSD classes and the build/bind from my dataClass
I need to build the response and build the itemListing by iterating through a datareader.
the dr returns 0 or more rows, 1 IndividualUpdateListRespon
XSD-classes1-5.vb
DataClass.vb
ASKER
ah, thank you sir!
that should mean that I can do something to the effect of:
Try
dr = MyCommand.ExecuteReader()
Dim i As Integer = 0
While dr.Read
response.IndividualUpdateL istRespons eItem(i).q ts_inciden t_id = dr(0)
response.IndividualUpdateL istRespons eItem(i).q ts_message _id = dr(1)
response.IndividualUpdateL istRespons eItem(i).t itle = dr(2)
response.IndividualUpdateL istRespons eItem(i).l og_date = dr(3)
response.IndividualUpdateL istRespons eItem(i).d irection = dr(4)
response.IndividualUpdateL istRespons eItem(i).i sOriginal = dr(5)
i = i + 1
End While
dr.Close()
Catch ex As Exception
response.ResponseRecordAtt ributes.sy stype = "fail"
response.ResponseRecordAtt ributes.sy smessage = "cannot perform list query. " & ex.Message
response.ResponseRecordAtt ributes.re sponseActi on = "IndividualUpdateList"
dr.Close()
End Try
I shall plug it in today!
by the way - for more points of course, do you know the easiest way to debug a (this) webservice?
... without building a full test consumer ...
Is there any way to just pass in an xml string while in debug mode?
that should mean that I can do something to the effect of:
Try
dr = MyCommand.ExecuteReader()
Dim i As Integer = 0
While dr.Read
response.IndividualUpdateL
response.IndividualUpdateL
response.IndividualUpdateL
response.IndividualUpdateL
response.IndividualUpdateL
response.IndividualUpdateL
i = i + 1
End While
dr.Close()
Catch ex As Exception
response.ResponseRecordAtt
response.ResponseRecordAtt
response.ResponseRecordAtt
dr.Close()
End Try
I shall plug it in today!
by the way - for more points of course, do you know the easiest way to debug a (this) webservice?
... without building a full test consumer ...
Is there any way to just pass in an xml string while in debug mode?
When I build a web service, I usually have a test web client in the same solution. That way, you can step through the client code, into the web methods, to track down problems. There might be another approach, but I haven't needed to find one.
I would think that, if that syntax works, it looks good to me. The only thing that I could suggest is that I don't like ordinal index when referencing columns on a data reader. You can use field names in place of index numbers to reference fields.
dr(0) doesn't make any sense, and dr("IncidentID") makes much more sense.
I would think that, if that syntax works, it looks good to me. The only thing that I could suggest is that I don't like ordinal index when referencing columns on a data reader. You can use field names in place of index numbers to reference fields.
dr(0) doesn't make any sense, and dr("IncidentID") makes much more sense.
ASKER
Thanx!
I see your point and agree about the referencing columns.
I'm quite a beginner, given so - what's the best way to build a test web client inside the service?
should I
- create a sub project inside existing project
- reference the xsd classes
- build functions for requests (with fixed vlaues)
- button clicks call functions
- functions return requests ...
? how do I submit the requests to the webservice? <- from each function?
? as a consumer - could I import the wsdl - and what would that actually do for me?
sorry - but I could use a good point into the right direction ...
I see your point and agree about the referencing columns.
I'm quite a beginner, given so - what's the best way to build a test web client inside the service?
should I
- create a sub project inside existing project
- reference the xsd classes
- build functions for requests (with fixed vlaues)
- button clicks call functions
- functions return requests ...
? how do I submit the requests to the webservice? <- from each function?
? as a consumer - could I import the wsdl - and what would that actually do for me?
sorry - but I could use a good point into the right direction ...
Hmmm...best way...best way...(thinking)...
I would say that the way that I achieve this goal may not be the "best" way but it is at least one way.
1) Run the web service on the localhost IIS.
2) Add a Windows Forms application (easier to work with than an ASP.NET web site project) to the solution.
3) Add a web reference to the localhost web service.
4) Create a form that creates an instance of the web service proxy class that is generated when you add a web reference.
5) Create some stress test methods on the form--add any necessary UI elements to trigger tests.
6) Another approach, if you have the capability, is to create a test project (Team Suite edition or NUnit).
I would say that the way that I achieve this goal may not be the "best" way but it is at least one way.
1) Run the web service on the localhost IIS.
2) Add a Windows Forms application (easier to work with than an ASP.NET web site project) to the solution.
3) Add a web reference to the localhost web service.
4) Create a form that creates an instance of the web service proxy class that is generated when you add a web reference.
5) Create some stress test methods on the form--add any necessary UI elements to trigger tests.
6) Another approach, if you have the capability, is to create a test project (Team Suite edition or NUnit).
ASKER
would you choose a web forms app or a test project?
I can create a test project - but I've never worked with one.
well, I've never made a windows form app either ... I've only worked with asp.net vb.net ...
with a test project could I automate processes?
it looks like I can run tests and test views, I created a dummy test project. But I don't have 'Team Edition for Software Testers'
the webservice has 4 methods, so it's not relaly 'big' at all.
I can create a test project - but I've never worked with one.
well, I've never made a windows form app either ... I've only worked with asp.net vb.net ...
with a test project could I automate processes?
it looks like I can run tests and test views, I created a dummy test project. But I don't have 'Team Edition for Software Testers'
the webservice has 4 methods, so it's not relaly 'big' at all.
You just need something that can give you a way to step into web methods to troubleshoot, so the decision is really up to you. I prefer Windows Forms applications, because they are easy to create, but you are certainly free to use a test project, or a web site.
ASKER
ok, so referring to your numbers above,
1 - done
2 - done - named QtsService.Test and with class Test
3 - done - named localhostQtsService
4- I use the imports call to the webreference - i get this:
Imports QtsService.Test.localhostQ tsService ... is that right?
I also added a project reference to the assemblies project which contains my xsd classes ... so I can build the xml requests
looks like this:
-------------------------- ---------- -------
Imports QtsService.Assemblies
Imports QtsService.Test.localhostQ tsService
Public Class test
Public Function test_CreateInquiry() As InquiryCreateRequest
Dim request As New InquiryCreateRequest
request.InquiryCreateRecor d.category = "Accounts"
request.InquiryCreateRecor d.type = "Entries"
request.InquiryCreateRecor d.title = "help with problem"
request.InquiryCreateRecor d.comments = "this is my question"
request.InquiryCreateRecor d.email = "me@this.com"
request.InquiryCreateRecor d.phone_nr = "+46 22 123 348"
request.InquiryCreateRecor d.ext_clie ntpty_id = "12341234123412"
request.InquiryCreateRecor d.ext_clie ntpty_name = "Client Industries"
request.InquiryCreateRecor d.ext_user _id = "x12345"
request.InquiryCreateRecor d.ext_user _name = "Peter ClientMan"
request.InquiryCreateRecor d.country = country.SE
Return request
End Function
Private Sub test_create_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles test_create.Click
test_CreateInquiry()
End Sub
End Class
-------------------------- ---------- -------
does this look like it makes sense? How do I send this to the webservice ?
I'll up the points to whatever you like if you can help me get through the set up of the debugger ! Not only that but you would be savin my but too!
I know it's more than i started out with ... but i do so appreciate the help!
1 - done
2 - done - named QtsService.Test and with class Test
3 - done - named localhostQtsService
4- I use the imports call to the webreference - i get this:
Imports QtsService.Test.localhostQ
I also added a project reference to the assemblies project which contains my xsd classes ... so I can build the xml requests
looks like this:
--------------------------
Imports QtsService.Assemblies
Imports QtsService.Test.localhostQ
Public Class test
Public Function test_CreateInquiry() As InquiryCreateRequest
Dim request As New InquiryCreateRequest
request.InquiryCreateRecor
request.InquiryCreateRecor
request.InquiryCreateRecor
request.InquiryCreateRecor
request.InquiryCreateRecor
request.InquiryCreateRecor
request.InquiryCreateRecor
request.InquiryCreateRecor
request.InquiryCreateRecor
request.InquiryCreateRecor
request.InquiryCreateRecor
Return request
End Function
Private Sub test_create_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles test_create.Click
test_CreateInquiry()
End Sub
End Class
--------------------------
does this look like it makes sense? How do I send this to the webservice ?
I'll up the points to whatever you like if you can help me get through the set up of the debugger ! Not only that but you would be savin my but too!
I know it's more than i started out with ... but i do so appreciate the help!
In order to debug the web service, you just need to place a breakpoint on the line where you have a call to a web method in the client code. Since your web service code is loaded in the IDE as part of the solution, the debugger should recognize that, and step through the web method call.
ASKER
Yep, I understand about the breakpoint and step through. But how do I actually call the web method from the consumer. I've attached the wsdl file (change txt to wsdl) as reference.
A method in the service is RetrieveInquiryCreateReque st
but that's not in intellisense ... among other things in intellisense are RetrieveInquiryCreateReque stRequest
also, I tried
Dim request As New localhostQtsService.Retrie veInquiryC reateReque stRequest
request.RequestRecordAttri butes.requ estAction = "InquiryCreateRequest"
. . . . . .
in debug I get the error NullReferenceException
Object reference not set to an instance of an object.
but i instanciated it with new ..?
you think you can help me with the actual syntax to call the webmethod and to pass it the parameters?
QtsService.txt
A method in the service is RetrieveInquiryCreateReque
but that's not in intellisense ... among other things in intellisense are RetrieveInquiryCreateReque
also, I tried
Dim request As New localhostQtsService.Retrie
request.RequestRecordAttri
. . . . . .
in debug I get the error NullReferenceException
Object reference not set to an instance of an object.
but i instanciated it with new ..?
you think you can help me with the actual syntax to call the webmethod and to pass it the parameters?
QtsService.txt
That sounds like you are not working with the web service correctly. If you look at the WSDL file, you can see data elements (objects), like RetrieveInquiryCreateReque st, RetrieveInquiryCreateReque stResponse , etc. There are also web methods listed:
RetrieveInquiryCreateReque st
<wsdl:message name="RetrieveInquiryCreat eRequestSo apIn">
<wsdl:part name="parameters" element="tns:RetrieveInqui ryCreateRe quest" />
RetrieveInquiryUpdate
<wsdl:message name="RetrieveInquiryUpdat eSoapIn">
<wsdl:part name="parameters" element="tns:RetrieveInqui ryUpdate" />
</wsdl:message>
Each request method has a corresponding response object (RetrieveInquiryCreateRequ estRespons e, RetrieveInquiryUpdateRespo nse).
Is there some kind of documentation (3rd party web service), or do you have control over the web service?
RetrieveInquiryCreateReque
<wsdl:message name="RetrieveInquiryCreat
<wsdl:part name="parameters" element="tns:RetrieveInqui
RetrieveInquiryUpdate
<wsdl:message name="RetrieveInquiryUpdat
<wsdl:part name="parameters" element="tns:RetrieveInqui
</wsdl:message>
Each request method has a corresponding response object (RetrieveInquiryCreateRequ
Is there some kind of documentation (3rd party web service), or do you have control over the web service?
ASKER
it's my webservice - just finished it.
coding wise the entire webservice producer and 'response' methods worked ok. The only problem I had was what started this thread ... but you took care of that ..
it doesn't feel right on the request side. maybe the web reference function didn't work well. What files can i upload which would help you see it better?
that wsdl i uploaded was created from the web reference on the consumer side - I compared it to the produecr wsdl and they are identical ...
coding wise the entire webservice producer and 'response' methods worked ok. The only problem I had was what started this thread ... but you took care of that ..
it doesn't feel right on the request side. maybe the web reference function didn't work well. What files can i upload which would help you see it better?
that wsdl i uploaded was created from the web reference on the consumer side - I compared it to the produecr wsdl and they are identical ...
You can show me a web method, and tell me what it is supposed to do...
ASKER
ok, so - the service itself resides in my main project, QTS. the webmethod then calls a processManager in a subproject called businessLogic. the processManager works it through and itself calls another subproject - DataAccess, where the db queries reside, DataAccess calls SP's ...
btw this is a support system - an inquiry management system. Until now every new inquiry was created and inside the system. this function receives an inquiry 'creation' from another application, which will then continue to be managed within the system.
so - the web method - under services/QtsService.asmx:
-------------------------- ------
<WebMethod()> _
<Description("create a new inquiry investigation instance")> _
Public Function RetrieveInquiryCreateReque st(ByVal request As InquiryCreateRequest) As InquiryCreateResponse
Dim manager As New BusinessProcessManager()
Return manager.RetrieveInquiryCre ateRequest (request)
End Function
-------------------------- ---
the processManager:
-------------------------- ---
Public Function RetrieveInquiryCreateReque st(ByVal request As InquiryCreateRequest) As InquiryCreateResponse
'REQUEST
' + required +
'country
'category
'type
'title
'comments
'ext_clientpty_id
' - optional -
'ext_clientpty_name
'ext_user_id
'ext_user_name
'email
'phoneNr
'int_user_id
'RESPONSE
' + required +
'qts_incident_id
'acknowledge
Dim response As New InquiryCreateResponse
Dim access As New QtsService.DataAccess.Data Class
'resolve Client
Dim myClientId As String = access.ResolveClientId(req uest.Inqui ryCreateRe cord.ext_c lientpty_i d)
If myClientId = "fail" Then
response.ResponseRecordAtt ributes.sy stype = "fail"
response.ResponseRecordAtt ributes.sy smessage = "qts service fail: cannot resolve client ID."
response.ResponseRecordAtt ributes.re sponseActi on = "InquiryCreate"
Return response
End If
'resolve team [ROUTING]
Dim myTeamId As String
If Not myClientId = "fail" And Not myClientId = "14234" Then '14234 = External Non-QTS Client
'we have a client already existing in QTS
myTeamId = Routing(request.InquiryCre ateRecord. ext_client pty_id, CStr(request.InquiryCreate Record.cou ntry), request.InquiryCreateRecor d.type) 'we still send the 14 digit kurrenr to Routing
Else
'client is unresolvable = force route to EBS SE
myTeamId = "72"
End If
'resolve category
Dim myCategoryId As String = access.ResolveCategoryId(r equest.Inq uiryCreate Record.cat egory, myTeamId)
If myCategoryId = "fail" Then
response.ResponseRecordAtt ributes.sy stype = "fail"
response.ResponseRecordAtt ributes.sy smessage = "qts service fail: cannot resolve category ID"
response.ResponseRecordAtt ributes.re sponseActi on = "InquiryCreate"
Return response
End If
'resolve type
Dim myTypeId As String = access.ResolveTypeId(reque st.Inquiry CreateReco rd.type, myCategoryId)
If myTypeId = "fail" Then
response.ResponseRecordAtt ributes.sy stype = "fail"
response.ResponseRecordAtt ributes.sy smessage = "qts service fail: cannot resolve type ID"
response.ResponseRecordAtt ributes.re sponseActi on = "InquiryCreate"
Return response
End If
'resolve owner_person
Dim myOwnerPerson As String = access.ResolveOwnerPersonI d(myTeamId , request.RequestRecordAttri butes.subm itting_app _qtsid)
If myOwnerPerson = "fail" Then
response.ResponseRecordAtt ributes.sy stype = "fail"
response.ResponseRecordAtt ributes.sy smessage = "qts service fail: cannot resolve owner_person_id"
response.ResponseRecordAtt ributes.re sponseActi on = "InquiryCreate"
Return response
End If
'resolve uid
Dim myUid As String = IncidentNr(myOwnerPerson)
'to create incident from external app we:
'insert inquiry (inquiry details)
'insert inquiry_work (work/response time details)
'insert inquiry_workinprogress (investigation creation)
'insert externalWipDetails (external app details and association to investigation)
'for inquiry insert we need:
'myClientId
'myTypeId
'myOwnerPerson
Dim myComments As String = request.InquiryCreateRecor d.comments
'for inquiry_work insert we need:
'
'for inquiry_workinprogress insert we need:
Dim mySavename As String = request.InquiryCreateRecor d.title
'myUid
'for externalWipDetails insert we need:
Dim myExt_clientpty_id As String = request.InquiryCreateRecor d.ext_clie ntpty_id
Dim myExt_clientpty_name As String = request.InquiryCreateRecor d.ext_clie ntpty_id
Dim myExt_user_id As String = request.InquiryCreateRecor d.ext_user _id
Dim myExt_user_name As String = request.InquiryCreateRecor d.ext_user _name
Dim myExt_user_email As String = request.InquiryCreateRecor d.email
Dim myExt_user_phone As String = request.InquiryCreateRecor d.phone_nr
Try
response = access.InquiryCreateReques tData(myCl ientId, myTypeId, myOwnerPerson, myComments, mySavename, myUid, myExt_clientpty_id, myExt_clientpty_name, myExt_user_id, myExt_user_name, myExt_user_email, myExt_user_phone)
response.ResponseRecordAtt ributes.sy smessage = "success"
response.ResponseRecordAtt ributes.re sponseActi on = "InquiryCreate"
Catch ex As Exception
response.ResponseRecordAtt ributes.sy stype = "fail"
If Not response.ResponseRecordAtt ributes.sy smessage = "" Then
'this should capture message from dataClass, if not then
response.ResponseRecordAtt ributes.sy smessage = ex.Message
End If
response.ResponseRecordAtt ributes.re sponseActi on = "InquiryCreate"
End Try
Return response
End Function
-------------------------- ---------- -
the dataAccess just executes SP's and returns the values
This all went pretty much straight forward ...
I just can't for the life of me get the consumer up. It's mostly my inexperience on a really basic level.
I just really need to push a static request into the webservice - example:
request.InquiryCreateRecor d.category = "Accounts"
request.InquiryCreateRecor d.type = "Entries"
request.InquiryCreateRecor d.title = "help with problem"
request.InquiryCreateRecor d.comments = "this is my question"
request.InquiryCreateRecor d.email = "me@this.com"
request.InquiryCreateRecor d.phone_nr = "+46 22 123 348"
request.InquiryCreateRecor d.ext_clie ntpty_id = "12341234123412"
request.InquiryCreateRecor d.ext_clie ntpty_name = "Client Industries"
request.InquiryCreateRecor d.ext_user _id = "x12345"
request.InquiryCreateRecor d.ext_user _name = "Peter ClientMan"
request.InquiryCreateRecor d.country = "SE"
.... thanx for the help :)
btw this is a support system - an inquiry management system. Until now every new inquiry was created and inside the system. this function receives an inquiry 'creation' from another application, which will then continue to be managed within the system.
so - the web method - under services/QtsService.asmx:
--------------------------
<WebMethod()> _
<Description("create a new inquiry investigation instance")> _
Public Function RetrieveInquiryCreateReque
Dim manager As New BusinessProcessManager()
Return manager.RetrieveInquiryCre
End Function
--------------------------
the processManager:
--------------------------
Public Function RetrieveInquiryCreateReque
'REQUEST
' + required +
'country
'category
'type
'title
'comments
'ext_clientpty_id
' - optional -
'ext_clientpty_name
'ext_user_id
'ext_user_name
'phoneNr
'int_user_id
'RESPONSE
' + required +
'qts_incident_id
'acknowledge
Dim response As New InquiryCreateResponse
Dim access As New QtsService.DataAccess.Data
'resolve Client
Dim myClientId As String = access.ResolveClientId(req
If myClientId = "fail" Then
response.ResponseRecordAtt
response.ResponseRecordAtt
response.ResponseRecordAtt
Return response
End If
'resolve team [ROUTING]
Dim myTeamId As String
If Not myClientId = "fail" And Not myClientId = "14234" Then '14234 = External Non-QTS Client
'we have a client already existing in QTS
myTeamId = Routing(request.InquiryCre
Else
'client is unresolvable = force route to EBS SE
myTeamId = "72"
End If
'resolve category
Dim myCategoryId As String = access.ResolveCategoryId(r
If myCategoryId = "fail" Then
response.ResponseRecordAtt
response.ResponseRecordAtt
response.ResponseRecordAtt
Return response
End If
'resolve type
Dim myTypeId As String = access.ResolveTypeId(reque
If myTypeId = "fail" Then
response.ResponseRecordAtt
response.ResponseRecordAtt
response.ResponseRecordAtt
Return response
End If
'resolve owner_person
Dim myOwnerPerson As String = access.ResolveOwnerPersonI
If myOwnerPerson = "fail" Then
response.ResponseRecordAtt
response.ResponseRecordAtt
response.ResponseRecordAtt
Return response
End If
'resolve uid
Dim myUid As String = IncidentNr(myOwnerPerson)
'to create incident from external app we:
'insert inquiry (inquiry details)
'insert inquiry_work (work/response time details)
'insert inquiry_workinprogress (investigation creation)
'insert externalWipDetails (external app details and association to investigation)
'for inquiry insert we need:
'myClientId
'myTypeId
'myOwnerPerson
Dim myComments As String = request.InquiryCreateRecor
'for inquiry_work insert we need:
'
'for inquiry_workinprogress insert we need:
Dim mySavename As String = request.InquiryCreateRecor
'myUid
'for externalWipDetails insert we need:
Dim myExt_clientpty_id As String = request.InquiryCreateRecor
Dim myExt_clientpty_name As String = request.InquiryCreateRecor
Dim myExt_user_id As String = request.InquiryCreateRecor
Dim myExt_user_name As String = request.InquiryCreateRecor
Dim myExt_user_email As String = request.InquiryCreateRecor
Dim myExt_user_phone As String = request.InquiryCreateRecor
Try
response = access.InquiryCreateReques
response.ResponseRecordAtt
response.ResponseRecordAtt
Catch ex As Exception
response.ResponseRecordAtt
If Not response.ResponseRecordAtt
'this should capture message from dataClass, if not then
response.ResponseRecordAtt
End If
response.ResponseRecordAtt
End Try
Return response
End Function
--------------------------
the dataAccess just executes SP's and returns the values
This all went pretty much straight forward ...
I just can't for the life of me get the consumer up. It's mostly my inexperience on a really basic level.
I just really need to push a static request into the webservice - example:
request.InquiryCreateRecor
request.InquiryCreateRecor
request.InquiryCreateRecor
request.InquiryCreateRecor
request.InquiryCreateRecor
request.InquiryCreateRecor
request.InquiryCreateRecor
request.InquiryCreateRecor
request.InquiryCreateRecor
request.InquiryCreateRecor
request.InquiryCreateRecor
.... thanx for the help :)
Let's review:
1) Create an instance of the web service proxy.
Example:
Dim weatherService As New WeatherStation.WeatherServ ice
2) Create an instance of a class
Example:
Dim forecastRequest As New ForecastRequest
forecastRequest.ZipCode = "31509"
3) Call a web method and get a response
Example:
Dim forecastResult As ForecastResult = weatherService.GetForecast ForZipCode (forecastR equest)
1) Create an instance of the web service proxy.
Example:
Dim weatherService As New WeatherStation.WeatherServ
2) Create an instance of a class
Example:
Dim forecastRequest As New ForecastRequest
forecastRequest.ZipCode = "31509"
3) Call a web method and get a response
Example:
Dim forecastResult As ForecastResult = weatherService.GetForecast
ASKER
thanx,
on no. 2
ln1- Dim forecastRequest As New ForecastRequest
ln2- forecastRequest.ZipCode = "31509"
I get a
Object reference not set to an instance of an object. on ln2
even though it's instanciated with new on ln1 ..
??
on no. 2
ln1- Dim forecastRequest As New ForecastRequest
ln2- forecastRequest.ZipCode = "31509"
I get a
Object reference not set to an instance of an object. on ln2
even though it's instanciated with new on ln1 ..
??
If line 1 didn't work, then there was a problem with the constructor. That doesn't sound good. This sounds like a good place to use debugging.
If you place a break point on this line in the IDE:
Dim request As New localhostQtsService.Retrie veInquiryC reateReque stRequest
you should be able to step into the constructor for RetrieveInquiryCreateReque stRequest.
If you place a break point on this line in the IDE:
Dim request As New localhostQtsService.Retrie
you should be able to step into the constructor for RetrieveInquiryCreateReque
ASKER
Imports WebApplication7_testServ.q tsserv
Partial Public Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim myRequest As New qtsserv.RetrieveIndividual UpdateList Request
myRequest.IndividualUpdate ListRecord .ext_clien tpty_id = "55670003270004"
myRequest.IndividualUpdate ListRecord .ext_user_ id = "x12121"
myRequest.IndividualUpdate ListRecord .from_date = "2009-12-01 00:01:00"
myRequest.IndividualUpdate ListRecord .to_date = "2009-12-31 23:59:00"
Dim myService As New QtsService
myService.RetrieveIndividu alUpdateLi st(myReque st)
-> the attached pic is the prntscrn from vs ..
- well - I can't get a good pic with the intellisense visible - but for myRequest it says
IndividualUpdateListRecord | Nothing
IndividualUpdateListRecord Field | Nothing
RequestRecordAttributes | Nothing
RequestRecordAttributesFie ld | Nothing
Partial Public Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim myRequest As New qtsserv.RetrieveIndividual
myRequest.IndividualUpdate
myRequest.IndividualUpdate
myRequest.IndividualUpdate
myRequest.IndividualUpdate
Dim myService As New QtsService
myService.RetrieveIndividu
-> the attached pic is the prntscrn from vs ..
- well - I can't get a good pic with the intellisense visible - but for myRequest it says
IndividualUpdateListRecord
IndividualUpdateListRecord
RequestRecordAttributes | Nothing
RequestRecordAttributesFie
How is IndividualUpdateListRecord supposed to be set? Is it set in a web method call, or is it set from the proxy code that is generated? I have attached a screen image and code that explains what I mean by "proxy" class.
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:2.0.50727.3082
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict Off
Option Explicit On
Imports System
Imports System.ComponentModel
Imports System.Diagnostics
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Xml.Serialization
'
'This source code was auto-generated by Microsoft.VSDesigner, Version 2.0.50727.3082.
'
Namespace Weather
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.3053"), _
System.Diagnostics.DebuggerStepThroughAttribute(), _
System.ComponentModel.DesignerCategoryAttribute("code"), _
System.Web.Services.WebServiceBindingAttribute(Name:="WeatherSoap", [Namespace]:="http://ws.cdyne.com/WeatherWS/")> _
Partial Public Class Weather
Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
Private GetWeatherInformationOperationCompleted As System.Threading.SendOrPostCallback
Private GetCityForecastByZIPOperationCompleted As System.Threading.SendOrPostCallback
Private GetCityWeatherByZIPOperationCompleted As System.Threading.SendOrPostCallback
Private useDefaultCredentialsSetExplicitly As Boolean
'''<remarks/>
Public Sub New()
MyBase.New
Me.Url = Global.WindowsApplication2.My.MySettings.Default.WindowsApplication2_Weather_Weather
If (Me.IsLocalFileSystemWebService(Me.Url) = true) Then
Me.UseDefaultCredentials = true
Me.useDefaultCredentialsSetExplicitly = false
Else
Me.useDefaultCredentialsSetExplicitly = true
End If
End Sub
Screenshot.png
ASKER
Thank you!
I usually do show all files - but I never opened the .map and I never knew the reference.vb was the proxy class.
I've attached the ref file.
If i understand correctly it is set in the proxy class ..yes ? (as it should be)
by some stroke of ambition I tried:
Dim myRequest As New qtsserv.RetrieveIndividual UpdateList Request
Dim myrequestrecord As New qtsserv.RetrieveIndividual UpdateList RequestInd ividualUpd ateListRec ord
myrequestrecord.ext_client pty_id = "55670003270004"
myrequestrecord.ext_user_i d = "x12121"
myrequestrecord.from_date = "2009-12-01 00:01:00"
myrequestrecord.to_date = "2009-12-31 23:59:00"
Dim myService As New QtsService
myService.PreAuthenticate = True
myService.Credentials = System.Net.CredentialCache .DefaultCr edentials
myService.RetrieveIndividu alUpdateLi st(myReque st)
I can finally step into the debugging now - but I can't connect myrequestrecord to myRequest - so I can't send my values in ..
Reference.vb
I usually do show all files - but I never opened the .map and I never knew the reference.vb was the proxy class.
I've attached the ref file.
If i understand correctly it is set in the proxy class ..yes ? (as it should be)
by some stroke of ambition I tried:
Dim myRequest As New qtsserv.RetrieveIndividual
Dim myrequestrecord As New qtsserv.RetrieveIndividual
myrequestrecord.ext_client
myrequestrecord.ext_user_i
myrequestrecord.from_date = "2009-12-01 00:01:00"
myrequestrecord.to_date = "2009-12-31 23:59:00"
Dim myService As New QtsService
myService.PreAuthenticate = True
myService.Credentials = System.Net.CredentialCache
myService.RetrieveIndividu
I can finally step into the debugging now - but I can't connect myrequestrecord to myRequest - so I can't send my values in ..
Reference.vb
From the proxy class, here is the answer to my question above:
'''<remarks/>
<System.CodeDom.Compiler.G eneratedCo deAttribut e("System. Xml", "2.0.50727.3082"), _
System.SerializableAttribu te(), _
System.Diagnostics.Debugge rStepThrou ghAttribut e(), _
System.ComponentModel.Desi gnerCatego ryAttribut e("code"), _
System.Xml.Serialization.X mlTypeAttr ibute(Anon ymousType: =true, [Namespace]:="http://qts.sebank.se/services/")> _
Partial Public Class RetrieveIndividualUpdateLi stRequest
Private requestRecordAttributesFie ld As RetrieveIndividualUpdateLi stRequestR equestReco rdAttribut es
Private individualUpdateListRecord Field As RetrieveIndividualUpdateLi stRequestI ndividualU pdateListR ecord
'''<remarks/>
Public Property RequestRecordAttributes() As RetrieveIndividualUpdateLi stRequestR equestReco rdAttribut es
Get
Return Me.requestRecordAttributes Field
End Get
Set
Me.requestRecordAttributes Field = value
End Set
End Property
'''<remarks/>
Public Property IndividualUpdateListRecord () As RetrieveIndividualUpdateLi stRequestI ndividualU pdateListR ecord
Get
Return Me.individualUpdateListRec ordField
End Get
Set
Me.individualUpdateListRec ordField = value
End Set
End Property
End Class
You can see where the field and the property were created by the proxy generator, but nothing that constructs a new instance for those fields. You will need to create a new instance of those in your code.
Dim myRequest As New qtsserv.RetrieveIndividual UpdateList Request
myRequest.IndividualUpdate ListRecord = New IndividualUpdateListRecord ()
...
'''<remarks/>
<System.CodeDom.Compiler.G
System.SerializableAttribu
System.Diagnostics.Debugge
System.ComponentModel.Desi
System.Xml.Serialization.X
Partial Public Class RetrieveIndividualUpdateLi
Private requestRecordAttributesFie
Private individualUpdateListRecord
'''<remarks/>
Public Property RequestRecordAttributes() As RetrieveIndividualUpdateLi
Get
Return Me.requestRecordAttributes
End Get
Set
Me.requestRecordAttributes
End Set
End Property
'''<remarks/>
Public Property IndividualUpdateListRecord
Get
Return Me.individualUpdateListRec
End Get
Set
Me.individualUpdateListRec
End Set
End Property
End Class
You can see where the field and the property were created by the proxy generator, but nothing that constructs a new instance for those fields. You will need to create a new instance of those in your code.
Dim myRequest As New qtsserv.RetrieveIndividual
myRequest.IndividualUpdate
...
ASKER
I think that's what I did here:
Dim myRequest As New qtsserv.RetrieveIndividual UpdateList Request
Dim myrequestrecord As New qtsserv.RetrieveIndividual UpdateList RequestInd ividualUpd ateListRec ord
in your ex - for New IndividualUpdateListRecord () I get a 'type undefined'
the combination of the two would be
Dim myRequest As New qtsserv.RetrieveIndividual UpdateList Request
Dim myrequestrecord As New qtsserv.RetrieveIndividual UpdateList RequestInd ividualUpd ateListRec ord
myRequest.IndividualUpdate ListRecord = myrequestrecord
I have to leave for a meeting. I'll have to pick this up afterwards. Thanks so much for your time!
Dim myRequest As New qtsserv.RetrieveIndividual
Dim myrequestrecord As New qtsserv.RetrieveIndividual
in your ex - for New IndividualUpdateListRecord
the combination of the two would be
Dim myRequest As New qtsserv.RetrieveIndividual
Dim myrequestrecord As New qtsserv.RetrieveIndividual
myRequest.IndividualUpdate
I have to leave for a meeting. I'll have to pick this up afterwards. Thanks so much for your time!
Yeah, I didn't get the right type (Monday morning blues)...
Dim myRequest As New qtsserv.RetrieveIndividual UpdateList Request
myRequest.IndividualUpdate ListRecord = New RetrieveIndividualUpdateLi stRequestI ndividualU pdateListR ecord()
Dim myRequest As New qtsserv.RetrieveIndividual
myRequest.IndividualUpdate
ASKER
Thanx man! I appreciate your help!
All is moving forward relatively smoothly now ... all methods are debugged.
-> Except <- oddly enough -> the same problem I had when I started this question ...
object mgt and iteration throught enumerated object ...
the earlier post ( 30/12/09 10:25 AM, ID: 26144094 )
I changed the code to this:
Try
dr = MyCommand.ExecuteReader()
Dim i As Integer = 0
While dr.Read
responseItem = New IndividualUpdateListRespon seIndividu alUpdateLi stResponse Item
responseItem.qts_incident_ id = dr(0)
responseItem.qts_message_i d = dr(1)
responseItem.title = dr(2)
responseItem.log_date = dr(3)
'responseItem.direction = dr(4)
'responseItem.isOriginal = dr(5)
If dr(4) = "fromExtApp" Then
responseItem.direction = direction.fromExtApp
Else
responseItem.direction = direction.toExtApp
End If
If dr(5) = "yes" Then
responseItem.isOriginal = isOriginal.yes
Else
responseItem.isOriginal = isOriginal.no
End If
response.IndividualUpdateL istRespons eItem(i) = responseItem
i = i + 1
End While
'attributes are set in businessLogic
dr.Close()
Catch ex As Exception
response.ResponseRecordAtt ributes.sy stype = "fail"
response.ResponseRecordAtt ributes.sy smessage = "cannot perform list query. " & ex.Message
response.ResponseRecordAtt ributes.re sponseActi on = "IndividualUpdateList"
dr.Close()
End Try
I figure I have to instantiate my responseItem inside the while loop (a new item per row)
but - when I try to build my object response.IndividualUpdateL istRespons eItem(i) = responseItem
I get object ref not set ..?
don't suppose you have any ideas?
All is moving forward relatively smoothly now ... all methods are debugged.
-> Except <- oddly enough -> the same problem I had when I started this question ...
object mgt and iteration throught enumerated object ...
the earlier post ( 30/12/09 10:25 AM, ID: 26144094 )
I changed the code to this:
Try
dr = MyCommand.ExecuteReader()
Dim i As Integer = 0
While dr.Read
responseItem = New IndividualUpdateListRespon
responseItem.qts_incident_
responseItem.qts_message_i
responseItem.title = dr(2)
responseItem.log_date = dr(3)
'responseItem.direction = dr(4)
'responseItem.isOriginal = dr(5)
If dr(4) = "fromExtApp" Then
responseItem.direction = direction.fromExtApp
Else
responseItem.direction = direction.toExtApp
End If
If dr(5) = "yes" Then
responseItem.isOriginal = isOriginal.yes
Else
responseItem.isOriginal = isOriginal.no
End If
response.IndividualUpdateL
i = i + 1
End While
'attributes are set in businessLogic
dr.Close()
Catch ex As Exception
response.ResponseRecordAtt
response.ResponseRecordAtt
response.ResponseRecordAtt
dr.Close()
End Try
I figure I have to instantiate my responseItem inside the while loop (a new item per row)
but - when I try to build my object response.IndividualUpdateL
I get object ref not set ..?
don't suppose you have any ideas?
I believe that problem is related to the fix that I showed you before, since the proxy generator doesn't include any code to instantiate the objects. Any time that you get that exception, you need to look at which objects you are trying to reference, and how they are supposed to be constructed. When there is any New construction for an object in the proxy class, then you need to handle that in your code.
ASKER
right - but as far as I can tell all objects for this response are instantiated ...
the shorthand of it looks like this ...
Dim response As New IndividualUpdateListRespon se
Dim responseItem As IndividualUpdateListRespon seIndividu alUpdateLi stResponse Item
...
Try
dr = MyCommand.ExecuteReader()
Dim i As Integer = 0
While dr.Read
responseItem = New IndividualUpdateListRespon seIndividu alUpdateLi stResponse Item
responseItem.qts_incident_ id = dr(0)
...
response.IndividualUpdateL istRespons eItem(i) = responseItem
i = i + 1
End While
dr.Close()
...
End Try
as far as i can tell there are no other objects for this response ... ?
the shorthand of it looks like this ...
Dim response As New IndividualUpdateListRespon
Dim responseItem As IndividualUpdateListRespon
...
Try
dr = MyCommand.ExecuteReader()
Dim i As Integer = 0
While dr.Read
responseItem = New IndividualUpdateListRespon
responseItem.qts_incident_
...
response.IndividualUpdateL
i = i + 1
End While
dr.Close()
...
End Try
as far as i can tell there are no other objects for this response ... ?
OK, what line are you getting that error on?
ASKER
response.IndividualUpdateL istRespons eItem(i) = responseItem
Does the IndividualUpdateListRespon seItem array have a size?
ASKER
minOccurs=0
maxOccurs=unbounded
maxOccurs=unbounded
ASKER
<System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038"), _
System.SerializableAttribute(), _
System.Diagnostics.DebuggerStepThroughAttribute(), _
System.ComponentModel.DesignerCategoryAttribute("code"), _
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=True, [Namespace]:="http://qts.sebank.se/services/"), _
System.Xml.Serialization.XmlRootAttribute([Namespace]:="http://qts.sebank.se/services/", IsNullable:=False)> _
Partial Public Class IndividualUpdateListResponse
Private responseRecordAttributesField As ResponseRecordAttributes
Private individualUpdateListResponseItemField() As IndividualUpdateListResponseIndividualUpdateListResponseItem
'''<remarks/>
Public Property ResponseRecordAttributes() As ResponseRecordAttributes
Get
Return Me.responseRecordAttributesField
End Get
Set(ByVal value As ResponseRecordAttributes)
Me.responseRecordAttributesField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute("IndividualUpdateListResponseItem")> _
Public Property IndividualUpdateListResponseItem() As IndividualUpdateListResponseIndividualUpdateListResponseItem()
Get
Return Me.individualUpdateListResponseItemField
End Get
Set(ByVal value As IndividualUpdateListResponseIndividualUpdateListResponseItem())
Me.individualUpdateListResponseItemField = value
End Set
End Property
End Class
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038"), _
System.SerializableAttribute(), _
System.Diagnostics.DebuggerStepThroughAttribute(), _
System.ComponentModel.DesignerCategoryAttribute("code"), _
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=True, [Namespace]:="http://qts.sebank.se/services/")> _
Partial Public Class IndividualUpdateListResponseIndividualUpdateListResponseItem
Private qts_incident_idField As String
Private qts_message_idField As String
Private titleField As String
Private log_dateField As String
Private isOriginalField As isOriginal
Private directionField As direction
'''<remarks/>
Public Property qts_incident_id() As String
Get
Return Me.qts_incident_idField
End Get
Set(ByVal value As String)
Me.qts_incident_idField = value
End Set
End Property
The minOccurs and maxOccurs are only in the .xsd schema to define validity, not to create a size.
You need something like this:
Redim response.IndividualUpdateL istRespons eItem(10)
You need something like this:
Redim response.IndividualUpdateL
ASKER
hmmm so -
i need to :
dim and instance the response
dim item
count the rows in the datareader result
redim the item(to rowcount -1)
run the while loop
instance item(i)
assign vals
increment i
next
does that sound right?
i need to :
dim and instance the response
dim item
count the rows in the datareader result
redim the item(to rowcount -1)
run the while loop
instance item(i)
assign vals
increment i
next
does that sound right?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I've never 'Redim Preserve' 'd before ... I'll have to check that out
i primitively managed the below
... hmm ... didn't realize you can't get a rowcout from a datareader ... huh and recordsaffected is invalid as a row count
i primitively managed the below
... hmm ... didn't realize you can't get a rowcout from a datareader ... huh and recordsaffected is invalid as a row count
Try
dr = MyCommand.ExecuteReader()
Dim i As Integer = 0
While dr.Read
i = i + 1
End While
dr.Close()
ReDim response.IndividualUpdateListResponseItem(i)
dr = MyCommand.ExecuteReader()
i = 0
While dr.Read
responseItem = New IndividualUpdateListResponseIndividualUpdateListResponseItem
...
response.IndividualUpdateListResponseItem(i) = responseItem
i = i + 1
End While
...
dr.Close()
End Try
ASKER
on the consumer test side I'm running
Dim myResponse As New qtsServLocal.RetrieveIndiv idualUpdat eListRespo nseRetriev eIndividua lUpdateLis tResult
myResponse = myService.RetrieveIndividu alUpdateLi st(myReque st)
you don't happen to know how to tostring the response xml?
Dim myResponse As New qtsServLocal.RetrieveIndiv
myResponse = myService.RetrieveIndividu
you don't happen to know how to tostring the response xml?
OK, let's take a step back, and look at what you have...
If you think that you need a record count, it would be better to use a data adapter, instead of opening the data reader twice.
Example:
If you think that you need a record count, it would be better to use a data adapter, instead of opening the data reader twice.
Example:
Dim tableProduct As New DataTable()
Dim connectionString As String = ConfigurationManager.ConnectionStrings("AdventureWorks").ConnectionString
Using adapter As New SqlDataAdapter("Select * From Production.Product", connectionString)
adapter.Fill(tableProduct)
End Using
Dim recordCount As Integer = tableProduct.Rows.Count
If you open a web browser, and navigate to the URL for the web service, you should get a test page, where you can test the web method, and see the XML response.
ASKER
you're entirely correct. i completely forgot about the adapter. (It's been a long time since I've been actively programming ... the adapter would be much more manageable, I can also sort it before sending - I was about to modify the sp to order the select ...
If you have a stored procedure, remember that you need to change the CommandType for the adapter:
Using adapter As New SqlDataAdapter("spGetProducts", connectionString)
adapter.SelectCommand.CommandType = CommandType.StoredProcedure
...
ASKER
i don't get any test capabilities - only xml examples for soap 1.1 and 1.2 for the webmethods
i want to write the response xml in string format from the actual queries - to a textbox for example.
then I actually see the xml ...
i want to write the response xml in string format from the actual queries - to a textbox for example.
then I actually see the xml ...
ASKER
thanx for the reminder !!
you really deserve more points than I can give - apparently 500 is the maximum?
(I'm real new to expExch)
I can't define my own point value?
I guess I can open new questions if you'd like :)
another party is developing the actual consumer and they just told me that they can't use soap1.2. My wsdl has bindings and port types for both versions - how can I steer the version of soap my response sends ? or does the engine manage it all for me / us)
you really deserve more points than I can give - apparently 500 is the maximum?
(I'm real new to expExch)
I can't define my own point value?
I guess I can open new questions if you'd like :)
another party is developing the actual consumer and they just told me that they can't use soap1.2. My wsdl has bindings and port types for both versions - how can I steer the version of soap my response sends ? or does the engine manage it all for me / us)
1) I have been doing this EE stuff for 10+ years, and it was never about the points, but more about teaching, and learning.
2) I believe that getting the SOAP response, while possible, is certainly beyond the scope of this question.
2) I believe that getting the SOAP response, while possible, is certainly beyond the scope of this question.
ASKER
thanx man!
you have been too good to me.
In all honesty - I'm happy no one replied at first, because this got 'auto-alerted' and I got you :)
seriously though - you got me through a hard time - thanx!
you have been too good to me.
In all honesty - I'm happy no one replied at first, because this got 'auto-alerted' and I got you :)
seriously though - you got me through a hard time - thanx!
ASKER
Excellent Help !!
response.IndividualUpdateL