Classic Asp Soap Client IXMLDOMSelection - soap

classic asp code for Soapclient
dim soapClient ,XMLReader, xmlDoc
Set soapClient = Server.CreateObject("MSSOAP.SoapClient30")
soapClient.ClientProperty("ServerHTTPRequest") = True
Call soapClient.MSSoapInit("http://www.jiemai.com/services/JieMaiSlService?wsdl")
soapClient.ConnectorProperty("Timeout") = 90000 '90 seconds
soapClient.ConnectorProperty("ConnectTimeout") = 90000 '90 seconds
Set result = soapClient.getAllCategories("1056aed3-eee8-409a-8be0-6dc65962686e", "1.0")
'REsponse.write Result(0)
Response.Write( TypeName( Result ) & "<br/>" & vbCrLf )
I am using the above code but i am getting 'IXMLDOMSelection' only that response can anyone please help me

As you can see you have an IXMLDOMSelection object. It is an iterable collection, so you can iterate or use Response.Write(result.context.xml) if you want only selection context, this will returns xml of tree.

Related

Redemption in MS Access / Outlook (trying to include a separate message file in email)

This code is in MS Access (2010) VBA, using the Redemption library with Microsoft Outlook 2010.
I had this process working before, but we recently had a Citrix upgrade that I guess reset something in my Outlook and now the process no longer works.
I have a folder of .msg files which are basically pre-made email templates with all the proper formatting, images, text, etc.
This is what I was doing before:
Dim outlookApp As Object, namespace As Object
Dim oItem, MyItem
Set outlookApp = CreateObject("Outlook.Application")
Set namespace = outlookApp.GetNamespace("MAPI")
namespace.Logon
Set MyItem = outlookApp.CreateItemFromTemplate(path_to_dot_msg_file)
'And then there are many calls like this:
MyItem.HTMLBody = Replace(MyItem.HTMLBody, "Dear Person,", "Dear " & name)
'...
Set safeItem = CreateObject("Redemption.SafeMailItem")
Set oItem = MyItem
safeItem.Item = oItem
'this next line displays the email, and as of this line, it looks correct
'safeItem.Display
'but as of this line, the issue occurs
safeItem.HTMLBody = "<p>This is an extra message that shows up before the .msg file</p>" & safeItem.HTMLBody
safeItem.Recipients.ResolveAll
safeItem.Send
Now when the email is sent, the .msg contents aren't present at all -- the only thing that shows up is the "extra message" that I prepended to the HTMLBody.
What do I need to change or update? Is this something I need to change in the code, or in my Outlook settings, etc?
Extra: body insertion:
Function insertStringBodyTag(htmlBody As String, stringToInsert As String)
Dim s As String
Dim i As Integer
s = htmlBody
i = InStr(1, s, "<body")
i = InStr(i, s, ">")
s = Left(s, i) & stringToInsert & Right(s, Len(s) - i)
insertStringBodyTag = s
End Function
'Called with safeItem.htmlBody = insertStringBodyTag(safeItem.htmlBody, prefix_string)
You cannot concatenate 2 HTML strings and expect a valid HTML string back - the two must be merged - find the position of the "<body"substring in the original HTML body, then find the positon of the following ">" (this way you take care of the body element with attributes), then insert your HTML string following that ">".

Parse a responseText to HTML in VBScript

I'm trying to retrieve HTML Class Names from a string variable created by responseText. I need to accomplish this using VBscript. Here is a sample of current code:
set http = createobject("Microsoft.XmlHttp")
http.open "GET","http://www.xxxxxxxxxxx.com/xxx-xxx?xxxxNumber=xxxxx",false
http.send ""
dim html : set html = CreateObject("HTMLFILE")
html.write http.responseText
dim trackdate : trackdate = html.getElementByClassName("tracking-history-date").[0].value
wscript.echo trackdate
I'm receiving the following error: Object doesn't support this property or mehtod: 'getElementByClassName'
I've run into this before. Although documented, the getElementsByClassName() method doesn't seem to actually be supported. Use something like this to work around the issue:
For Each el In html.getElementsByTagName("...")
If el.ClassName = "tracking-history-date" Then
Set trackdate = el
Exit For
End If
Next

Facebook & Classic ASP - Passing custom parameters to fan page tab - error with no data

We have our app working using this code (Is it possibile to pass parameters to the callback URL of a FB app which is accessed through a tab?), but the issue arises when there is no app_data parameter passed in. Here is an example of what we mean:
Works Fine: ("test" is written out fine)
https://www.facebook.com/phillypours/app_397493550309543?app_data=test
Does NOT Work:
https://www.facebook.com/phillypours/app_397493550309543
Code used with Base64 Encode & JSON Decode:
myArray = Split(Request("signed_request"), ".")
encoded_sig = myArray(0)
payload = myArray(1)
sig = base64_decode(Replace(encoded_sig, "-_", "+/"))
set data = JSON.parse(base64_decode(Replace(payload, "-_", "+/")))
Response.Write data.app_data
This is the error we receive when no parameter is passed in:
Object doesn't support this property or method: 'data.app_data'
Anyone have any thoughts on how to trap for this? I cannot do anything with "data.app_data" since this is what throws the error.
Any help would be greatly appreciated!!!
Thank you.
Dennis
I found a work around for this. Wanted to share to others could benefit. thanks, Dennis
<!--#INCLUDE VIRTUAL="/includes/fb_base64.asp"-->
<!--#INCLUDE VIRTUAL="/includes/fb_json_decode.asp"-->
Function parsePageSignedRequest()
If Request("signed_request") <> "" Then
myArray = Split(Request("signed_request"), ".")
payload = myArray(1)
payload_decoded = base64_decode(payload)
set data = JSON.parse(payload_decoded)
If instr(payload_decoded,"""app_data""") Then
AppData = data.app_data
End If
If instr(payload_decoded,"liked"":true,") Then
LikeStatus = True
End If
End If
End Function

Trying to Insert QBO Credit Memo with IPP.NET

I am using IPP.Net to attempt to insert a single CreditMemo into Quickbooks Online. I have been successful inserting an invoice with similar code. My code for inserting the CreditMemo is as follows:
Try
Dim qboCreditMemo As New Intuit.Ipp.Data.Qbo.CreditMemo
Dim qboCreditMemoHdr As New Intuit.Ipp.Data.Qbo.CreditMemoHeader
Dim qboCreditMemoLine As Intuit.Ipp.Data.Qbo.CreditMemoLine
Dim CreditMemoLines As New List(Of Intuit.Ipp.Data.Qbo.CreditMemoLine)
Dim CreditMemoItemAttributes As Qbo.ItemChoiceType2()
Dim CreditMemoItemValues As Object()
For Each row In tblTrans.Rows
If bFirstRow Then
'Set CreditMemo header
qboCreditMemoHdr.DocNumber = "SMA" & CStr(row("batch_id"))
qboCreditMemoHdr.TxnDate = Format(row("acct_date"), "yyyy-MM-dd")
qboCreditMemoHdr.Msg = row("batch_descr")
qboCreditMemoHdr.CustomerId = New Intuit.Ipp.Data.Qbo.IdType
qboCreditMemoHdr.CustomerId.Value = row("iface_owner_id")
qboCreditMemo.Header = qboCreditMemoHdr
bFirstRow = False 'only do this once
End If
'Lines
qboCreditMemoLine = New Qbo.CreditMemoLine
qboCreditMemoLine.Desc = row("descr")
qboCreditMemoLine.Amount = row("amount_owner")
qboCreditMemoLine.AmountSpecified = True
CreditMemoItemAttributes = {Qbo.ItemsChoiceType2.ItemId, Qbo.ItemsChoiceType2.UnitPrice, Qbo.ItemsChoiceType2.Qty}
CreditMemoItemValues = {New Qbo.IdType With {.idDomain = Qbo.idDomainEnum.QBO, .Value = row("iface_item_id")}, row("unitPrice"), row("quantity")}
qboCreditMemoLine.ItemsElementName = CreditMemoItemAttributes
qboCreditMemoLine.Items = CreditMemoItemValues
qboCreditMemoLine.ClassId = New Intuit.Ipp.Data.Qbo.IdType
qboCreditMemoLine.ClassId.Value = row("iface_class_id")
CreditMemoLines.Add(qboCreditMemoLine) 'Add line to list of lines
Next row
qboCreditMemo.Line = CreditMemoLines.ToArray 'Add CreditMemo lines to CreditMemo lines property
resultCreditMemo = commonService.Add(qboCreditMemo) 'Add CreditMemo to request
Return "OK"
'Catch exID As Intuit.Ipp.Exception.IdsException
'Return exID.Message
Catch ex As Exception
Return ex.Message
End Try
I got an error with message 'Internal Server Error'. It seems to be an IdsException. As indicated in my other article, I was able to get detailed information for a BatchRequest through the Fault and Error objects. However, I do not understand how to get the details on this error for a single invoice using Dataservices.
I think I may need better error handling, assuming there is more information available for this error. And, I need help figuring out why the same properties that I set for an invoice would not work for a CreditMemo. Unfortunately the documentation in the Intuit website where the required properties are listed does not include a CreditMemo (though it includes an Invoice).
CreditMemo is not supported in QBO:
https://ipp.developer.intuit.com/0010_Intuit_Partner_Platform/0050_Data_Services/0400_QuickBooks_Online/0500_Supported_Entities_and_Operations
I had almost the same issue, and the problem was that the qty and amount should not be negative. I changed it on my creditmemoLine and it worked

How to INSERT into table using Entity Data Model (EDMX)

I am trying to write a button handler in VB.NET that will read rows from a gridview and write them to a DB if a checkbox is checked.
I setup this application to use EntityDataSource and added my .edmx file to a DAL folder. I have the button method written but I do not know enough about EF to know how to handle the data the data from the gridview. Here is my btn_click method:
Private Sub btnGetChecks_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnGetChecks.Click
'********************************************
'* gets status of checkbox and writes to db *
'********************************************
Dim row As GridViewRow
Label6.Text = ""
For Each row In DvsGridView.Rows
Dim RowCheckBox As CheckBox = CType(row.FindControl("chkStatus"), CheckBox)
If RowCheckBox.Checked Then
Label6.Text += row.Cells(5).Text & " Checked "
' Need to write checked data to the db
' ******* WHAT GOES HERE? *******
Else
Label6.Text += row.Cells(5).Text & " Unchecked "
End If
Next
End Sub
I am fairly new to EDMX but understand VB.net. Any direction would be greatly appreciated.
Check this sample code and modify this to match your entities and objects
Using db As New DBEntities()
'set values here
Dim x As New TableNameE()
x.col1 = "value1"
x.col2 = "value2"
db.AddToTableNameE(x)
db.SaveChanges()
End Using
Thanks to #rs., I was able to figure out my issues. Referring to the accepted answer, for those wondering what .AddToTableNameE() should be in your proj, it's just going to be .Add(x). It's also somewhat a performance hit using .SaveChanges() for every row, you should create a Dim List(Of TableNameE()) and add the "x" to the list, then use .AddRange() like this:
//creating a data access class is one way to connect to your db by passing in db path
Dim context As New Namespace.YourContext(New DataAccessClass() With {.Path = aBrowsedForSDFFileTextBoxMaybe.Text})
Dim listOfTableObjects As List(Of Namespace.TableObject) = New List(Of Namespace.TableObject)
For n = 1 To SomethingRelatedToRows
Dim tableObject As New Namespace.TableObject() With {
.entityProp1 = TableObject(n).entityProp1,
.entityProp2 = TableObject(n).entityProp2,
.entityProp3 = TableObject(n).entityProp3,
.entityProp4 = TableObject(n).entityProp4,
.entityProp5 = TableObject(n).entityProp5,
.entityProp6 = TableObject(n).entityProp6
}
listOfTableObjects.Add(tableObject)
Next n
//.TableObjects being the DbSet from the ...Context.vb file
context.TableObjects.AddRange(listOfTableObjects)
context.SaveChanges()