ksoap2 property info that has multiple parameter values? - web-services

i am using ksoap2 for my application in android.
i am sending complex types, but i have a question:
right now i am doing :
UriList urlL = new UriList();
urlL.uriList= "#literal";
PropertyInfo pi = new PropertyInfo();
pi.setName("documents");
pi.setValue(urlL);
pi.setType(UriList.class);
sobj.addProperty(pi);
this gives me a soap request that will look like:
< documents>
< uriList>#literal< /uriList>
< /documents>
what if i want to have several repetition of < uriList> ? ie:
< documents>
< uriList>#literal< /uriList>
< uriList>#literal2< /uriList>
< uriList>#literal3< /uriList>
< /documents>
how can i do that in ksoap2?
thanks for the help :)

i fixed this by doing the paramter urlist -in the class that implements kvmserializable- as a list and it worked

I used the envelope.addMapping() function when I had to do the same thing. Pretty much you create an object that implements KvmSerializable and holds all the data you want in the Parameter. It will take care of adding the items for you.
You can find more info about it on the following site: http://seesharpgears.blogspot.com/2010/10/ksoap-android-web-service-tutorial-with.html

Related

How to get placeholder size in TensorFlow C++ API?

I want to use C++ to load TensorFlow model. And I want to know size of model's input, which is the placeholder in the model.
I google this problem, but I just find this link in stackoverflow :
C++ equivalent of python: tf.Graph.get_tensor_by_name() in Tensorflow?
Although I can get node, but tensorflow document don't tell me how to access the size of the node. So is there anyone know something about this?
Thank you so much!
OK,after many times attempts. I have find a workaround solution, It maybe tricky but works well.
At first, we can get the placeholder node using following code:
GraphDef mygd = graph_def.graph_def();
for (int i = 0; i < mygd.node_size(); i++)
{
if (mygd.node(i).name() == input_name)
{
auto node = mygd.node(i);
}
}
Then through the NodeDef.pd.h(tensorflow/core/framework/node_def.pb.h), we can get AttrValue through code like below:
auto attr = node.attr();
Then through the attr_value.cc(tensorflow/core/framework/attr_value.cc), we can get the shape attr value through code like below:
tensorflow::AttrValue shape = attr["shape"];
and the shape AttrValue is the structure used to store shape information. We can get the detail information through the function SummarizeAttrValue in tensorflow/core/framework/attr_value_util.h
string size_summary = SummarizeAttrValue(shape);
And then we can get the string format of shape like below:
[?,1024]

How to get Body of the email using c++ builder

I want to get the email body from my Gmail account for an email so i use this code i found it in an example for how to read emails using c++ builder pop3
the code to extract body used
TIdText *EText;
int message = SpinEdit1->Value;
MyPoP3->Retrieve(message, MyEmail);
Edit1->Text = MyEmail->Subject + " | " + MyEmail->From->Address;
Memo1->Clear();
for (int i = 0; i < MyEmail->MessageParts->Count; i++) {
Memo1->Lines->Add(MyEmail->MessageParts->Items[i]->ContentType);
EText = dynamic_cast<TIdText*>(MyEmail->MessageParts->Items[i]);
Memo1->Lines->Add(EText->Body);
}
the problem is that i got undefine symbol to TidText and what i tried is to change it from TIdText to TIdMessage, but i got that i can't convert to it.
also i tried to try this without loop or something MyEmail->Body->Text
this return empty string.
the video i got this code from it here i don't know maybe the c++ builder he use is old. now i want to know how to extract the body text from the email address.
Thanks in advance.
the problem is that i got undefine symbol to TidText
Your code is missing an #include <IdText.hpp> statement.
what i tried is to change it from TIdText to TIdMessage, but i got that i can't convert to it.
Because TIdMessage does not contain nested TIdMessage objects.
also i tried to try this without loop or something MyEmail->Body->Text this return empty string.
If your email is MIME encoded, its text is not stored in the TIdMessage::Body property, but in a nested TIdText object within the TIdMessage::MessageParts collection. You have to look at the TIdMessage::ContentType property to know what kind of structure the email contains. For instance, if the CT begins with text/, the text is in the TIdMessage::Body. But if the CT begins with multipart/, the text is somewhere in the TIdMessage::MessageParts instead.
You should read this blog article on Indy's website for an example of how emails might be structured:
HTML Messages
the video i got this code from it here i don't know maybe the c++ builder he use is old.
No, it is not.

Writing a test in Laravel to determine if ORM items are in the correct order

I wrote a test to pull 10 articles from my database. I then wrote the code to make the test pass and it works. However, now I want to write a test to make sure the 10 articles I pull from the database are in descending order based on created_at. I'm not sure how to go about this, at all.
Test Method:
public function testPullTenArticles()
{
for ($i = 0; $i < 20; $i++)
{
$tempArticle = new Article;
$tempArticle->save();
}
$this->assertEquals(10, count($this->article->getArticles(10)));
}
Real Method:
public function getArticles($count)
{
$articles = Article::take($count)->get();
return $articles;
}
If you're using the orderBy clause to retrieve your objects, then you shouldn't need to test it - the good folks who wrote the Laravel & Eloquent code have already done that.
You can order your collection like this:
$articles = Article::orderBy("created_at", "desc")->take($count)->get();

Data loop using nodejs mailer template

I'm using node.js mailer module to send email template. I manage to send the template with the correct json replacements to the designated email address.
However, I am wondering if there's a shortcut to set the values of the replacement when there's too many similar replacements.
For example, i have an object "userNameList". It contains a list of usernames. I want to send the list of usernames using an email template. Instead of...
data: {
"username1":userNameList[1],
"username2":userNameList[2],
"username3":userNameList[3],
"username4":userNameList[4],
"username5":userNameList[5],
"username6":userNameList[6],
...
"username100":userNameList[100]
}
Is there a way to reduce the number of lines and for the code to work more effectively?
thanks.
You can use the following:
data = {};
for(var i=0; i<userNameList.length; i++) {
data["username" + (i+1)] = userNameList[i]; // Array indexes start at 0
}

Axis 1.4 Webservices Datetime NumberFormatException: Invalid date/time

I´m using axis 1.4 to retrieve information from a (server) webservice.
My WSDL have the following information:
< xs:element name="ABC">
< xs:complexType>
< xs:sequence>
< xs:element name="DEF">
< xs:complexType>
< xs:sequence>
< xs:element name="Data" type="xs:dateTime"/>
I have generated the stubs which origins the following code:
#XmlElement(name = "Data", required = true)
#XmlSchemaType(name = "dateTime" )
protected XMLGregorianCalendar data;
When i make a call to this webservice i get the following error.
My current request is:
2003-10-27T10:10:10.000Z
Note that i already try using different formats for date (i allways get the same error).
Supposedly, this is the corret format due the CalendarDeserializer [SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")].
Any help? Thanks :)
P.S- Sorry about the text formatation (i was getting crazy with the message "Your post appears to contain code that is not properly formatted as code. ")
The error is:
java.lang.NumberFormatException: Invalid date/time
org.apache.axis.encoding.ser.CalendarDeserializer.makeValue(CalendarDeserializer.java:64)
and 8 years later.... I was facing a similar issue with axis 1.3. I was able to consume the webservice by using this format "2020-01-09T17:00:00.000-03:00".
A bit late but may help others