JUDDI inquiry (find) for access point - wsdl

I need to find or do an inquiry for getting the access point using JUDDI from an already published service. I followed the procedure told in Apache jUDDI: Finding Templates. But it didn't work out and i get the following error from the Tomcat server:
Sep 01, 2012 11:29:58 AM org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
INFO: Application {urn:uddi-org:v3_service}UDDIInquiryService#{urn:uddi-org:v3_service}find_service has thrown exception, unwinding now: org.apache.juddi.v3.error.FatalErrorException: At least one name, categoryBag, find_tModel or tModelBag or name must be supplied
And also the same error is indicated in Netbeans IDE as:
javax.xml.ws.soap.SOAPFaultException: At least one name, categoryBag, find_tModel or tModelBag or name must be supplied
My code snippet is as follows:
FindService fs = new FindService();
fs.setAuthInfo(rootAuthToken.getAuthInfo());
fs.setBusinessKey("uddi:juddi.apache.org:e7180bfb-3c36-451e-86aa-f7605a96587c");
ServiceList sl = inquiry.findService(fs);
ServiceInfos si = sl.getServiceInfos();
GetServiceDetail gsd = new GetServiceDetail();
ServiceDetail sd = inquiry.getServiceDetail(gsd);
BusinessService bs = (BusinessService) sd.getBusinessService();
BindingTemplates bts = bs.getBindingTemplates();
BindingTemplate bt = (BindingTemplate) bts.getBindingTemplate();
AccessPoint ap = bt.getAccessPoint();
wsdlTA.setText(ap.getValue());

Never mind, I got it solved through the Apache JUDDI's project mailing list. Thanks to 秦玉珠 for the help. The code can be as follows:
ServiceList list1=inquiryService.findService(findservice);
GetServiceDetail gsd=new GetServiceDetail();
for(ServiceInfo serviceInfo :list1.getServiceInfos().getServiceInfo()){
gsd.getServiceKey().add(serviceInfo.getServiceKey());
System.out.println(serviceInfo.getServiceKey());
String servicekey=serviceInfo.getServiceKey();
GetServiceDetail getServiceDetail=new GetServiceDetail();
getServiceDetail.setAuthInfo(authinfo);
getServiceDetail.getServiceKey().add(servicekey);
ServiceDetail serviceDetail=inquiryService.getServiceDetail(getServiceDetail);
BusinessService businessservice=serviceDetail.getBusinessService().get(0);
System.out.println("fetched service name:"+businessservice.getName().get(0).getValue());
String bindingkey = businessservice.getBindingTemplates().getBindingTemplate().get(0).getBindingKey();
System.out.println(bindingkey);
GetBindingDetail gbd = new GetBindingDetail();
gbd.setAuthInfo(authinfo);
gbd.getBindingKey().add(bindingkey);
BindingDetail bindingdetail=inquiryService.getBindingDetail(gbd);
BindingTemplate bindingtemplate=bindingdetail.getBindingTemplate().get(0);
String accesspoint=bindingtemplate.getAccessPoint().getValue();
System.out.println(accesspoint);
}

Related

Can't preserve document core metadata (Created By, Modified By) when I import documents to SharePoint Document Library

I'm currently building a tool to migrate from a document management system to use SharePoint Online. The main challenge I'm facing is to preserve the details of document authors and creating time. I have checked bunch of of code online but I didn't get success with any of them.
Here are the approaches I used
SharePoint Rest API
Microsoft Graph API
CSOM (using console application)
Here is the code I have so far in CSOM but I'm still not able to update the Author field
li["Title"] = "Update from CSOM";
li["Created"] = DateTime.Now.AddYears(-5);
li["Author"] = author.Id;
li.UpdateOverwriteVersion();
clientContext.ExecuteQuery();
Any idea for how to do this, or if there is any other approach to achieve my goal?
The code works when I did test in my environment.
using (ClientContext context = new ClientContext("https://xxx.sharepoint.com/sites/lee"))
{
string s = "password";
SecureString passWord = new SecureString();
foreach (var c in s)
passWord.AppendChar(c);
context.Credentials = new SharePointOnlineCredentials("admin#xxx.onmicrosoft.com", passWord);
var author = context.Web.EnsureUser("Lee#xxx.onmicrosoft.com");
context.Load(author);
context.ExecuteQuery();
var _List = context.Web.Lists.GetByTitle("List1");
var li = _List.GetItemById(1);
li["Title"] = "Update from CSOM";
li["Created"] = DateTime.Now.AddYears(-5);
li["Author"] = author.Id;
li.UpdateOverwriteVersion();
context.ExecuteQuery();
}
You will need to update the Author and Editor fields at the same time in order to update the CreatedBy field. If you wish to update additional fields at the same time you can. Using SystemUpdate() does not update the Modified date whereas Update() does update the Modified date. See abbreviated sample below.
FieldUserValue userValue = new FieldUserValue();
User newUser = cc.Web.EnsureUser("newAuthor#xxx.onmicrosoft.com");
cc.Load(newUser);
cc.ExecuteQuery();
userValue.LookupId = newUser.Id;
item["Author"] = userValue;
item["Editor"] = userValue;
item.SystemUpdate();
cc.ExecuteQuery();

ADO.Net connection executing DB2 stored procedure returning pooled output parameter values using iSeries connection

[EDIT - This issue is resolved. The problem had to do with uninitialized out parameters on the stored procedure.]
Why would I need to turn connection pooling off to get this to work correctly???
[EDIT - connection pooling released a shared connection memory area on the AS400]
In my MVC web app I call a DB2 Stored Procedure (SP).
This SP has multiple in and out parameters similar to this pseudo code:
CreatePO(#REQNO[in], #PO[out], #Approver[out], #ErrorMsg[out])
My app writes data to tables used by this SP during its processing so when all the data is in place I call the SP and it tries to create a PO.
If the PO creation fails there will be an error message in the #ErrorMsg out parameter. In these cases the #PO and #Approver parameters should be blank.
Here's what happens in sequence:
1) I try to create my first PO but there is a problem...
CreatePO(100, blank, blank, blank)
which results in...
CreatePO(100, blank, blank, 'unable to determine approver')
2) I successfully create the 2nd PO...
CreatePO(101, blank, blank, blank)
CreatePO(101, 'P1234', 'JJONES', blank)
3) I try to re-create a PO for #REQNO 100
CreatePO(100, blank, blank, blank)
CreatePO(100, 'P1234', 'JJONES', 'unable to determine approver')
Step 3 has conflicting out parameters. The app pool is returning the PO and Approver from Step 2 along with the appropriate an error message.
If I recycle my IIS app pool then the results are back to what happened in Step #1.
I am able to get expected results I add "pooling=false" to the connection string. But why would output parameters be affected in this manner by connection pooling? This seems more like a bug than some sort of desirable caching method.
If I don't paste my code someone will get bent out of shape so here it is...
(Look at the end of the top two lines)
'Dim cs As String = "DataSource=mydb;UserID=myuser;Password=mypassword;Naming=System;ConnectionTimeout=180; DefaultIsolationLevel=ReadUncommitted;AllowUnsupportedChar=True;CharBitDataAsString=True; TransactionCompletionTimeout=0;pooling=false"
Dim cs As String = "DataSource=mydb;UserID=myuser;Password=mypassword;Naming=System;ConnectionTimeout=180; DefaultIsolationLevel=ReadUncommitted;AllowUnsupportedChar=True;CharBitDataAsString=True; TransactionCompletionTimeout=0;"
Using conn As New iDB2Connection(cs)
conn.Open()
Dim cmd As iDB2Command = New iDB2Command()
cmd.Connection = conn
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "BF6360CL"
' Input parameters
cmd.Parameters.Add(New iDB2Parameter With {.ParameterName = "#REQNO", .DbType = SqlDbType.Char, .Size = 7, .Value = model.RO})
' Output parameters
Dim opo = New iDB2Parameter With {.ParameterName = "#POORDER", .DbType = SqlDbType.Char, .Size = 7, .Direction = ParameterDirection.Output}
cmd.Parameters.Add(opo)
Dim oApprover = New iDB2Parameter With {.ParameterName = "#APPROVER", .DbType = SqlDbType.Char, .Size = 10, .Direction = ParameterDirection.Output}
cmd.Parameters.Add(oApprover)
Dim oStatus = New iDB2Parameter With {.ParameterName = "#STATUS", .DbType = SqlDbType.Char, .Size = 3, .Direction = ParameterDirection.Output}
cmd.Parameters.Add(oStatus)
Dim oErr = New iDB2Parameter With {.ParameterName = "#ERROR", .DbType = SqlDbType.Char, .Size = 1, .Direction = ParameterDirection.Output}
cmd.Parameters.Add(oErr)
' return value
Dim oRetval = New iDB2Parameter With {.ParameterName = "#RETURN_VALUE", .DbType = SqlDbType.Char, .Size = 10, .Direction = ParameterDirection.ReturnValue}
cmd.Parameters.Add(oRetval)
cmd.ExecuteNonQuery()
model.PO = opo.Value
model.Approver = oApprover.Value
model.Status = oStatus.Value
model.Err = oErr.Value
End Using
return model
So the big question is this:
Why on earth would connection pooling be responsible for out parameter values???
Could this be a bug in the IBM iSeries iDB2Connection implementation?
The IIS application pool is caching stored procedure output parameters by name and returning a cached value when nulls are detected. This happens with ODBC or iSeries connections. When I recycled the application pool this cached value went away. I added to the connection string “pooling=false;” and these cached values would no longer appear.
My boss asked me to try calling the stored procedure using iSeries Navigator just to see what the out parameters contain. Boy was I surprised.
It turned out that the Stored Procedure (SP) was at fault after all. I sat with the AS400 RPG developer this morning and watched them debug the SP. The problem had to do with uninitialized memory.
Here's the definition of the SP:
BF6360CL(#REQNO, #USER, #ENVIRONMENT, #PO[out], #Approver[out], #Status[out], #Error[out])
I then reset my connection to the AS400 in iSeries Navigator and the output parameters reset back to
4 = S2.RETU
5 = RN_VAR0000
etc...
The AS400 developer is making changes now to initialize the variables. When they're done I expect to be able to change my program back to use connection pooling.
When I reset the IIS App Pool it reset my connection to the database. This seemed to release allocated memory on the AS400.
If anyone has more specifics about Connections and AS400 output parameter memory please share.

Assign variable with punctuation in between it in lua

I'm trying to write a script for DC++ hub based on Ptokax running on lua
i'm trying to assign the nick(a variable) which has punctuation in between but it gives nil values
(sPattern is ! already assigned in script)
sData = "[11:03:30] !spm sTo_Nick sFromNick message to be sent"
cmd,sToNick1,sToNick2,sFromNick ,sMessage = string.match(sData, "%b<>%s["..sPattern.."](%a*)(%s+)(%w*)(%s+)(%w*)(%s+)(%.*)")
what i want to be assigned is
cmd = spm
sToNick1 = sTo ,
sToNick2 = Nick ,
sFromNick = sFromNick ,
sMessage = message to be sent
what i'm getting is
spm sTo _ Nick
as can be seen here https://repl.it/BrAg/3
can anyone please suggest the edit or help.
You need to rearrange the capture groups:
cmd,sToNick1,sToNick2,sFromNick,sMessage =
string.match(sData, "%b<>%s["..sPattern.."](%a*)%s+(%w*)"..pattern.."(%w*)%s+(%w*)%s+(.*)")
See the updated demo

QBFC Billadd GUID Error

I am new to C# and QBFC13 code and I'm trying to add a bill from code I found on the intuit developer site under the BillAdd section.
The BillAddRq.ExternalGUID.SetValue(Guid.NewGuid().ToString()); is throwing a error:
Invalid GUID format. Must use zero for Custom Fields, or a GUID generated with GuidGen.exe for private data extensions.
I’ve tried:
String guid = System.Guid.NewGuid().ToString("B");
// MessageBox to see that it creates the number
MessageBox.Show("guid", guid);
BillAddRq.ExternalGUID.SetValue(guid);
BillAddRq.ExternalGUID.SetValue(Guid.NewGuid().ToString("B"));
And
String guid = System.Guid.NewGuid().ToString("0");
And those throw:
QB Test 8-14-2014.vshost.exe - No Disk "There is no disk in the drive. Please insert a disk into drive F."
How can I resolve these errors?
Using your first string attempt is the correct format for the GUID. I tested using GUID.NewGuid().ToString("B") and was able to get a GUID that works when adding a bill.
Because you're getting an error about there being no disk in the drive, it sounds like something else is causing the error. I would step through the code and find the exact place that causes the error as it probably has nothing to do with the GUID.
Here's a simple example that I did using a sample file in QuickBooks:
QBSessionManager SessionManager = new QBSessionManager();
SessionManager.OpenConnection2("GUIDTest","GUIDTest", ENConnectionType.ctLocalQBD);
SessionManager.BeginSession("", ENOpenMode.omDontCare);
IMsgSetRequest MsgRequest = sessionManager.CreateMsgSetRequest("US", 13, 0);
MsgRequest.Attributes.OnError = ENRqOnError.roeContinue;
IBillAdd add = MsgRequest.AppendBillAddRq();
add.ExternalGUID.SetValue(System.Guid.NewGuid().ToString("B"));
add.VendorRef.FullName.SetValue("A Cheung Limited");
add.TxnDate.SetValue(DateTime.Today);
IExpenseLineAdd line = add.ExpenseLineAddList.Append();
line.AccountRef.FullName.SetValue("Travel & Lodging");
line.Amount.SetValue(100.00);
IResponse response = sessionManager.DoRequests(MsgRequest).ResponseList.GetAt(0);
MessageBox.Show(response.StatusMessage);

Unit Price Attribute Not Visible in Quickbooks Desktop API

I don't see the Unit Price attribute available in the Item Class when it comes to QBD. Its available in QBO. I am trying to download and fill a database using the items entered via Quickbooks desktop version. Can someone help please?
How can I get the Unit Price for an item in Intuit.Ipp.Data.Qbd.Item?
Extra Information Added after comment by Shivan Raptor (7-Nov-2013)
I am having a Quickbooks Pro Trial 2014 UK version installed in my computer. I have created a company file and items for the company. When I create an item I can enter a Price to that item. Quickbooks must be saving it somewhere. I need to access it using the Quickbooks API from my .Net application.
I am interested on the stock items here. I am using Intuit.Ipp.Data.Qbd.Item class to access it. Am I using the right class? If you go to the API documentation the Item class has a field called Unit Price but its not listed when you actually check from the .Net application.
Shivan Raptor wanted the code (8-Nov-2013)
Given below is the code snippet. If you understand the question properly you would realize it cannot give a run time error because you cannot compile a code if you write it with object attributes that are not exposed. And the compiler error is kind of obvious too:
ATTRIBUTE_NAME not present in CLASS_NAME
In this case, ATTRIBUTE_NAME = UnitPrice and CLASS_NAME = Intuit.Ipp.Data.Qbd.Item (this is already there in the first post itself)
The relevant code sample is given below. Its the code behind of an ASP.Net page.
Try
Dim varItemBL As New BL.ItemManagement
'Preparing Query
Dim qbdItemQuery As New Intuit.Ipp.Data.Qbd.ItemQuery
qbdItemQuery.ItemElementName = Intuit.Ipp.Data.Qbd.ItemChoiceType4.StartPage
qbdItemQuery.Item = "1"
qbdItemQuery.ChunkSize = "10"
'Quering Quickbooks Desktop
Dim qbdItems = qbdItemQuery.ExecuteQuery(Of Intuit.Ipp.Data.Qbd.Item)(context).ToList
'Synchronising Items from Quickbooks to MyDigiRep
For i As Integer = 0 To qbdItems.Count - 1
Dim varUnitPrice As Decimal
'Checking whether Unit Price is entered
If qbdItems(i).UnitPrice Is Nothing Then
varUnitPrice = 0
Else
varUnitPrice = qbdItems(i).UnitPrice.Amount
End If
'Synchronising Item with the MyDigiRep database
varItemBL.fnAddItemsAPI(qbdItems(i).Name, "NS", varUnitPrice, _
qbdItems(i).UOMAbbrv, HttpContext.Current.Session("companyID"), _
qbdItems(i).Id.Value)
Next
'Updating UI to display synchronisation results
lblItemSycnStatus.Text = qbdItems.Count & " Item Records Synchronised."
Catch ex As Exception
lblItemSycnStatus.Text = "Item Records Synchronisation Failed."
End Try
The version of the Intuit.Ipp.Data.dll is 2.1.12.0

Resources