Axis 1.4 Webservices Datetime NumberFormatException: Invalid date/time - web-services

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

Related

Named parameter can't be used more than one time in a query of Data Service

We are using WXSO2 EI 6.5.0. I prepared Data Service with such simple query:
<sql>SELECT e.code ,e.firstName,e.lastName,e.birthday FROM dbo.elaba_USERS_EMPLOYEES e WHERE e.firstName like :someText or e.lastName like :someText </sql>
<param name="someText" paramType="SCALAR" sqlType="STRING"/>
Query produces response
<axis2ns1092:DataServiceFault xmlns:axis2ns1092="http://ws.wso2.org/dataservice">
<axis2ns1092:current_params>{someText=Gar6va}</axis2ns1092:current_params>
<axis2ns1092:source_data_service>
<axis2ns1092:data_service_name>ElabaDataTest</axis2ns1092:data_service_name>
<axis2ns1092:description>N/A</axis2ns1092:description>
<axis2ns1092:location>/ElabaDataTest.dbs</axis2ns1092:location>
<axis2ns1092:default_namespace>http://ws.wso2.org/dataservice</axis2ns1092:default_namespace>
</axis2ns1092:source_data_service>
<axis2ns1092:ds_code>DATABASE_ERROR</axis2ns1092:ds_code>
<axis2ns1092:nested_exception>java.lang.NullPointerException</axis2ns1092:nested_exception>
<axis2ns1092:current_request_name>_get_users_employeestest</axis2ns1092:current_request_name>
</axis2ns1092:DataServiceFault>
If I delete one criteria with parameter :some Text, query works properly.
Such queries worked in WSO DSS 3.5.1 without problems.
After some investigation I found a mistake in class
org.wso2.carbon.dataservices.core.description.query.ExpressionQuery. There is a method processDynamicQuery and code
if (tmpParam != null && !(tempParams.get(i).isOptional()) && DBConstants.DataTypes.QUERY_STRING.equals(tmpParam.getSqlType())) {
is not correct.
...tempParams.get(i).isOptional()
throws null pointer exception.
It would be very nice to find fixed code.

How do i convert cpr's get response into a json object?

I was looking for a easy to understand library that make HTTP REST Requests in C++ and then i came across CPR. I was successfully able to get the response from the server but i find it difficult to access the returned JSON object.
API Get Request:
auto r = cpr::Get(cpr::Url{ "https://example.net/api/token" },
cpr::Parameters{ {"username", login}, {"password", password},
{"hwid", "TestChecker"}, {"obt", "1"}});
r.status_code;
r.header["application/json"];
r.text;
I tried to pass r.text into nlohmann::json j = r.text; and access the particular object i wanted like this string xx = j["token"];
As expected, it threw an error.
I'd really appreciate it if anyone could tell me how to achieve what i failed to do.
Edit : Added References
CPR : https://www.codeproject.com/Articles/1244632/Making-HTTP-REST-Request-in-Cplusplus
nlohmann/json : https://github.com/nlohmann/json
I did play around a bit with the code and finally figured it out.
Basically what i wanted to do was to convert a "JSON String" into a JSON Object.
I achieved it by using the method nlohmann::json::parse();
Json j = Json::parse(r.text);
string xx = j["token"];

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.

How to parse output from sse.client in Python?

I am new to Python and am trying to get my ahead around parsing SSE client code. I am using the SSE Client library. My code is very basic and follows the sample exactly. Here it is:
from sseclient import SSEClient
devID = "xxx"
AToken = "xxx"
sparkURL = 'https://api.spark.io/v1/devices/' + devID + '/events/?access_token=' + AToken
messages = SSEClient(sparkURL)
for msg in messages:
print(msg)
print(type(msg))
The code runs without a problem and I see some blank lines and SSE data coming through. Here is the sample output:
<class 'sseclient.Event'>
{"data":"0 days, 0:54:43","ttl":"60","published_at":"2015-04-09T22:43:52.084Z","coreid":"xxxx"}
<class 'sseclient.Event'>
<class 'sseclient.Event'>
{"data":"0 days, 0:55:3","ttl":"60","published_at":"2015-04-09T22:44:12.092Z","coreid":"xxx"}
<class 'sseclient.Event'>
The actual output above looks like a dictionary, but its type is "sseclient.Event". I am trying to figure out how to parse the output so I can pull out one of the fields and nothing I have tried has worked.
Sorry if this is basic questions, but can someone provide some simple guidance on how I would either convert the entire output to a dictionary or perhaps just pull out one of the fields?
Thank you in advance!
I figured this out. In case anyone else experiences the same problem, here is how I got it to work. The key was using msg.data and not just msg. I then converted the out using the JSON library and am good to go.
messages = SSEClient(sparkURL)
for msg in messages:
outputMsg = msg.data
if type(outputMsg) is not str:
outputJS = json.loads(outputMsg)
FilterName = "data"
#print( FilterName, outputJS[FilterName] )
print(outputJS[FilterName])

SBL-ODU-01007 The HTTP request did not contain a valid SOAPAction header

I am hoping someone can help get me in the right direction...
I am using Powerbuilder 12 Classic and trying to consume a Oracle CRM OnDemand web service.
Using Msxml2.XMLHTTP.4.0 commands, I have been able to connect using https and retrieve the session id, which I need to send back when I invoke the method.
When I run the code below, I get the SBL-ODU-01007 The HTTP request did not contain a valid SOAPAction header error message. I am not sure what I am missing??
OleObject loo_xmlhttp
ls_get_url = "https://secure-ausomxxxx.crmondemand.com/Services/Integration?command=login"
try
loo_xmlhttp = CREATE oleobject
loo_xmlhttp.ConnectToNewObject("Msxml2.XMLHTTP.4.0")
loo_xmlhttp.open ("GET",ls_get_url, false)
loo_xmlhttp.setRequestHeader("UserName", "xxxxxxx")
loo_xmlhttp.setRequestHeader("Password", "xxxxxxx")
loo_xmlhttp.send()
cookie = loo_xmlhttp.getResponseHeader("Set-Cookie")
sesId = mid(cookie, pos(cookie,"=", 1)+1, pos(cookie,";", 1)-(pos(cookie,"=", 1)+1))
ls_post_url = "https://secure-ausomxxxx.crmondemand.com/Services/Integration/Activity;"
ls_response_text = "jsessionid=" + sesId + ";"
ls_post_url = ls_post_url + ls_response_text
loo_xmlhttp.open ("POST",ls_post_url, false)
loo_xmlhttp.setRequestHeader("COOKIE", left(cookie,pos(cookie,";",1)-1) )
loo_xmlhttp.setRequestHeader("COOKIE", left(cookie,pos(cookie,";",1)-1) )
ls_post_url2 = "document/urn:crmondemand/ws/activity/10/2004:Activity_QueryPage"
loo_xmlhttp.setRequestHeader("SOAPAction", ls_post_url2)
loo_xmlhttp.send()
ls_get_url = "https://secure-ausomxxxx.crmondemand.com/Services/Integration?command=logoff"
loo_xmlhttp.open ("POST",ls_get_url, false)
loo_xmlhttp.send()
catch (RuntimeError rte)
MessageBox("Error", "RuntimeError - " + rte.getMessage())
end try
I believe you are using incorrect URL for Login and Logoff;
Here is the sample:
https://secure-ausomxxxx.crmondemand.com/Services/Integration?command=login
https://secure-ausomxxxx.crmondemand.com/Services/Integration?command=logoff
Rest of the code looks OK to me.
I have run into similar issues in PB with msxml through ole. Adding this may help:
loo_xmlhttp.setRequestHeader("Content-Type", "text/xml")
you need to make sure that the your value for ls_post_url2 is one of the values that is found in the wsdl file. Just search for "soap:operation soapAction" in the wsdl file to see the valid values for SOAPAction.