android:ksoap issue - android-ksoap2

I am new in Androi. I use the ksoap for web service.There is two input float values are there in web service request but return the error
java.lang.RuntimeException: Cannot serialize: 67.296652
then i set to int for testing, but then after during the response i get the error
java.lang.ClassCastException: java.util.Vector
I have reference code from http://seesharpgears.blogspot.com/2010/10/ksoap-android-web-service-tutorial-with.html
Thank you.

I get the answer, when we add the new data type like double or date then need to create the new classes the answer is here, http://seesharpgears.blogspot.com/2010/11/implementing-ksoap-marshal-interface.html

Related

Passing List objects through Braid

I try to invoke a flow through Braid. The flow takes a List<UniqueIdentifier> object as input parameter. When invoking the flow I get the following error:
error: -32000: java.util.LinkedHashMap cannot be cast to net.corda.core.contracts.UniqueIdentifier
Can someone help with this?
This is a deserialisation error of Braid. It might get fixed in a future version. A workaround at the moment is to use Array objects instead of List objects in Corda.
Useful functions are:
List.toTypedArray()
and
Array.asList()

How to import a document in UCM using ridc

I am trying to import a archived document that was checked-in earlier, but I want to import it using RIDC program, following is the code I am working on:
IdcClientManager manager = new IdcClientManager();
IdcClient idcClient= manager.createClient("http://localhost/idc/idcplg");
IdcContext idcContext = new IdcContext("sysadmin", "idc");
// get the binder
DataBinder binder = idcClient.createBinder();
//populate the binder with the parameters
binder.putLocal("IdcService", "IMPORT_DOCUMENT");
binder.putLocal("Idc_Name", "idc");
binder.putLocal("aArchiveName", "idc//test1");
binder.putLocal("dDocName", "000022");
binder.putLocal("dCollectionName", "test_checkin");
ServiceResponse response = idcClient.sendRequest(idcContext, binder);
DataBinder binderResult = response.getResponseAsBinder();
But I am getting the following error:
Unable to execute service IMPORT_DOCUMENT and function executeArchiveMethod.
(System Error: The collection name must be specified.)
I specified dCollectionID, dCollectionName,dCollectionLocation, but faced same result.
Can anyone guide me about this error, or where I am getting wrong in implementing this code.
For better understanding I would like to tell that the specified document was earlier checked in using WebDAV.
Any kind of help will be grateful.
Parameters are case-sensitive. You need to use IDC_Name.

Rest camel passing objects between endpoints

Overview.
My camel setup calls two service methods. the response of the first one is passed into the second one and then output the final response as json webpage. Fairly simple nothing too complicated.
Further breakdown to give some more context.
Method_1. Takes in scanId. This works ok. It produces an object called ScheduledScan .class
Method_2. Takes in object previous instance of ScheduledScan .class and returns a list of ConvertedScans scans. Then would like to display said list
Description of the code
#Override
public void configure() throws Exception {
restConfiguration().bindingMode(RestBindingMode.json);
rest("/publish")
.get("/scheduled-scan/{scanId}")
.to("bean:SentinelImportService?method=getScheduledScan").outType(ScheduledScan .class)
.to("bean:SentinelImportService?method=convertScheduledScan");
}
The methods that are called look like the following
ScheduledScan getScheduledScan(#Header("scanId") long scanId);
List<ConvertedScans > convertScheduledScan(#Body ScheduledScan scheduledScans);
It is returning the the following error
No body available of type: path. .ScheduledScan but has value:
of type: java.lang.String on: HttpMessage#0x63c2fd04. Caused by: No type converter available
The following runs without the error, i.e. without method 2. So I think im almost there.
rest("/publish")
.get("/scheduled-scan/{scanId}")
.to("bean:SentinelImportService?method=getScheduledScan");
Now from reading the error it looks like im passing in a HttpMessage not the java object? I'm a bit confused about what to do next? Any advice much appreciated.
I have found some similar questions to this message. However I am looking to pass the java object directly into the service method.
camel-rest-bean-chaining
how-to-share-an-object-between-methods-on-different-camel-routes
You should setup the outType as the last output, eg what the REST response is, that is a List/Array and not a single pojo. So use .outTypeList(ConvertedScans.class) instead.

How to unit test asp.net api if using Application

In my globals.asax.cs, I am creating a dictionary object that I want to use in my APIs to add and get data from in the life of the application.
I do the following:
Application["MyDictionary"] = myDictionary;
In my ApiController I get a handle of it, in this way:
MyDictionary myDictionary= (MyDictionary)HttpContext.Current.Application["MyDictionary"];
So far so good, the issue is that I need to do the same in the unit test, I need to add this dictionary into my Application as well, so when I call my controller, I will be able to retrieve it, how do I do that ?
doing this:
HttpContext.Current.Application.Add("MyDictionary", myDictionary);
enter code here
doesn't work, I get an exception:
An exception of type 'System.NullReferenceException' occurred in RESTServices.Tests.dll but was not handled in user code
My HttpContext.Current is null.
Any ideas how to work around this ?
The HttpContext.Current is created when a request is received, so you need to set the Current property, before using it.
See the example below:
var myDictionary = new Dictionary<string, string>();
HttpContext.Current = new HttpContext(new HttpRequest("default.aspx", "http://localhost", string.Empty), new HttpResponse(new StringWriter(CultureInfo.InvariantCulture)));
HttpContext.Current.Application.Add("MyDictionary", myDictionary);

DbLimitExpression requires a collection argument

Does anyone have the faintest idea what this error means please and how to resolve it? All my research is drawing a blank, I can see how to set it on MSDN but it doesn't explain it in a way that explains to me what the issue is. If I remove some of my LINQ queries to set viewbag items then it seems to resolve it but the moment I set new ones and pass them into my view to generate a mail for MVCMailer it comes back. Not sure if its a viewbag issue or simply that I am calling too many linq queries to generate them to pass to the view.
I am very stuck (again)..........
Cheers,
Steve.
DbLimitExpression requires a collection argument.
Parameter name: argument
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: DbLimitExpression requires a collection argument.
Parameter name: argument
An example of the code is:
var VBSalutation = from A in context.Salutations
where A.SalutationId == policytransaction.SalutationId
select A.SalutationName;
ViewBag.Salutation = VBSalutation.FirstOrDefault();
This is repeated for various parameters and then passed to the view.
Well, I faced a similar problem and solved it. Problem was in WHERE clause: data type of left side equal operator (=) sign was not matching with data type of right side. So in your scenario:
where A.SalutationId == policytransaction.SalutationId
SalutationID of A might be an INT and SalutationId of policytransaction might be a string (This is how it was in my case).
I solved it by assigning policytransaction.SalutationId to an Int variable and using it:
int myIntVariable = Convert.ToInt16(policytransaction.SalutationId);
...//some code here
where A.SalutationId == myIntVariable;
Please also note that you cannot directly cast your variables directly in Linq else you'll get an error "LINQ to Entities does not recognize the method". You'll have to use a temp variable and then apply the where clause.
Try ViewBag.Salutation = VBSalutation.SingleOrDefault();

Resources