Nexmo SMS with visual foxpro - visual-studio-2010

I am unable to send Nexmo-SMS with foxpro application. Application was working till January 2017 after that it stopped working. Given below is my application. It gives the error message 404. Kindly guide me if there is correction require the program.
mob = '39829374'
mmessage = 'Hi'
username='username'
pwd='password'
mmob1 =ALLTRIM(mmob )
MMOB = '00973'+ALLTRIM(mmob )
From='AMA Motors'
to = '&mmob'
lcMessage=mmessage
lcNexmo = Textmerge("http://rest.nexmo.com/sms/xml?username=<< m.username >>|password=<< m.pwd >>|from=<< m.from >>|to=<< m.to >>|text=<< m.lcMessage >>")
lcNexmo = Chrtran(m.lcNexmo, '|', Chr(38))
* Message parameters ready
Local loXmlHttp As "Microsoft.XMLHTTP"
loXmlHttp = Newobject( "Microsoft.XMLHTTP" )
loXmlHttp.Open( "POST" , m.lcNexmo, .F. )
loXmlHttp.Send( )
If loXmlHttp.Status = 200
lcXML =
StrExtract(loXmlHttp.responsetext,'<messages','</messages>',1,1+4)
XMLToCursor(m.lcXML,'myresult')
* browse
Else
MessageBox( Textmerge( "An error occurred in SMS. Status <<loXmlHttp.STATUS>> (<<loXmlHttp.statustext>>)." ) )
Endif

I would think that your code has never worked. Probably you put here a version that wouldn't work at all. Anyway, I think the problem is that you are not using https. I edited your code a bit and sent 3 messages (sorry for wasting your tokens):
NexmoKey = '1b37ecc8'
NexmoSecret = 'df183c07'
NexmoNumber = 'AMA Motors'
mob = '39829374'
mmessage = 'Hi'
MMOB = '00973'+ALLTRIM(m.mob )
to = m.mmob
lcMessage = m.mmessage
nexmoURL = Textmerge(;
"https://rest.nexmo.com/sms/xml?"+;
"username=<< m.NexmoKey >>|"+;
"password=<< m.NexmoSecret >>|"+;
"from=<< m.NexmoNumber >>")
TrySendTTS(m.to,m.lcMessage, m.NexmoUrl)
Procedure TrySendTTS(tcPhone,tcMessage, tcNexmoUrl)
tcMessage = Strtran(m.tcMessage, '%0A', '%0D%0A')
lcUrl = Chrtran(;
Textmerge("<< m.tcNexmoUrl >>|to=<< m.tcPhone >>|text=<< m.tcMessage >>"), '|', Chr(38))
Local loXmlHttp As "Microsoft.XMLHTTP"
loXmlHttp = Newobject( "Microsoft.XMLHTTP" )
loXmlHttp.Open( "POST" , m.lcUrl, .F. )
* loXmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded")
loXmlHttp.Send( )
? loXmlHttp.Status = 200
? loXmlHttp.responsetext
Endproc
And this is the response I got to the latest send:
<?xml version='1.0' encoding='UTF-8' ?>
<mt-submission-response>
<messages count='1'>
<message>
<to>97339829374</to>
<messageId>0B00000044C5B1ED</messageId>
<status>0</status>
<remainingBalance>6.23650000</remainingBalance>
<messagePrice>0.01740000</messagePrice>
<network>42601</network>
</message>
</messages>
</mt-submission-response>

Related

DocuSign Require Signing Document Twice with Different Tabs

I have a document that is using tabs to fill a document. The document is signed before and after completion of a task. Is it possible to modify tabs on an envelope - then re-generate an DocuSign_eSign::RecipientViewRequest (still having the initial signature / fields)?
Thus far I've been able to generate two DocuSign_eSign::RecipientViewRequest, but cannot figure out how to change the tabs in between signing:
PRE_SIGNER = 'pre_signer'
POST_SIGNER = 'post_signer'
PRIVATE_KEY = CREDENTIALS['private_key']
PUBLIC_KEY = CREDENTIALS['public_key']
USER_ID = CREDENTIALS['user_id']
CLIENT_ID = CREDENTIALS['client_id']
ACCOUNT_ID = CREDENTIALS['account_id']
BASE_URL = CREDENTIALS['base_url']
configuration = DocuSign_eSign::Configuration.new
configuration.host = "#{BASE_URL}/restapi"
configuration.debugging = true
api_client = DocuSign_eSign::ApiClient.new(configuration)
api_client.base_path = BASE_URL
envelope_api = DocuSign_eSign::EnvelopesApi.new(api_client)
pre_signer_text = DocuSign_eSign::Text.new
pre_signer_text.value = 'Alpha'
pre_signer_text.tab_label = 'pre_value'
pre_signer = DocuSign_eSign::Signer.new
pre_signer.role_name = PRE_SIGNER
pre_signer.client_user_id = PRE_SIGNER
pre_signer.recipient_id = 1
pre_signer.name = 'Kevin Sylvestre'
pre_signer.email = 'kevin#fake.com'
pre_signer.tabs = DocuSign_eSign::Tabs.new
pre_signer.tabs.text_tabs = [pre_signer_text]
post_signer = DocuSign_eSign::Signer.new
post_signer.role_name = POST_SIGNER
post_signer.client_user_id = POST_SIGNER
post_signer.recipient_id = 2
post_signer.name = 'Kevin Sylvestre'
post_signer.email = 'kevin#fake.com'
post_signer.tabs = DocuSign_eSign::Tabs.new
post_signer.tabs.text_tabs = []
server_template = DocuSign_eSign::ServerTemplate.new
server_template.sequence = 0
server_template.template_id = TEMPLATE_ID
inline_template = DocuSign_eSign::InlineTemplate.new
inline_template.sequence = 0
inline_template.recipients = DocuSign_eSign::Recipients.new
inline_template.recipients.signers = [
pre_signer,
post_signer,
]
composite_template = DocuSign_eSign::CompositeTemplate.new
composite_template.server_templates = [server_template]
composite_template.inline_templates = [inline_template]
envelope_event = DocuSign_eSign::EnvelopeEvent.new
envelope_event.envelope_event_status_code = 'completed'
envelope_definition = DocuSign_eSign::EnvelopeDefinition.new
envelope_definition.status = 'sent'
envelope_definition.composite_templates = [composite_template]
api_client.request_jwt_user_token(CLIENT_ID, USER_ID, PRIVATE_KEY)
envelope = envelope_api.create_envelope(ACCOUNT_ID, envelope_definition)
pre_signer_recipient_view_request = DocuSign_eSign::RecipientViewRequest.new
pre_signer_recipient_view_request.authentication_method = 'none'
pre_signer_recipient_view_request.client_user_id = PRE_SIGNER
pre_signer_recipient_view_request.user_name = 'Kevin Sylvestre'
pre_signer_recipient_view_request.email = 'kevin#fake.com'
pre_signer_recipient_view_request.return_url = 'https://ksylvest.com'
pre_recipient_view = envelope_api.create_recipient_view(ACCOUNT_ID, envelope.envelope_id, pre_signer_recipient_view_request)
url = pre_recipient_view.url
`open #{url}`
puts "Continue?"
gets
# at this point I'd like to enter values for tabs...
post_signer_text = DocuSign_eSign::Text.new
post_signer_text.value = 'Omega'
post_signer_text.tab_label = 'post_value'
post_signer_recipient_view_request = DocuSign_eSign::RecipientViewRequest.new
post_signer_recipient_view_request.authentication_method = 'none'
post_signer_recipient_view_request.client_user_id = POST_SIGNER
post_signer_recipient_view_request.user_name = 'Kevin Sylvestre'
post_signer_recipient_view_request.email = 'kevin#fake.com'
post_signer_recipient_view_request.return_url = 'https://ksylvest.com'
post_recipient_view = envelope_api.create_recipient_view(ACCOUNT_ID, envelope.envelope_id, post_signer_recipient_view_request)
url = post_recipient_view.url
`open #{url}`
You could add the same person to sign twice, as two separate recipients that are the same person. You can generate different recipient views. You can set the routing order to be different. Only reason I didn't post this as an answer is that you may mean that you need to pause the envelope?
you can add tabs using your code where you have post_signer.tabs, but if you want to modify existing tabs that came from the template then you have to create the envelope in draft mode ("created") and then make a different API call to modify the tabs and then a final API call to send it. Another option is to pause the envelope and "correct" it.
Pause envelope workflow code examples
https://github.com/docusign/docusign-esign-ruby-client/blob/c477b07c2f578214fdf7d0c5a33355f01e9a0b4e/lib/docusign_esign/api/envelopes_api.rb#L6132 update_recipients() method should do the trick...

Error 71561: Unresolved reference to object

In Visual Studio 2017, SSDT 2015, I am receiving the "unresolved reference to object" error. This error is occurring 2,589 times, so it's not an issue with one particular piece of code. All of the code compiles and runs in SQL Server directly.
I've tried everything from this post, except for disabling "extended Transact-SQL verification for common objects" because that option has been removed.
I've tried pretty much everything else I can find on Google; I've been banging away on this for two days now.
Here is an example of some of the code that's getting the error. It runs fine on SQL Server directly. The error comes up in the FROM clause on each line that contains a database reference. I can't remove those references or change the location of the view. This is also happening in stored procedures that reference the views.
CREATE view [Migration].[vwCHILDS_Allegation_AllegationTrackingCharacteristics]
as
with src as (
select
(select AllegationId from CWNS_Migration.Allegation.Allegation where SourceSystemId = cast(1 as int) and SourceSystemIdentifier = cast(a.IDNBR as nvarchar(64))) AllegationId
, (select TrackingCharacteristicsId from CWNS_Migration.Allegation.TrackingCharacteristics where Code = dfrvmi1.DestinationDataFieldReferenceValueCode) TrackingCharacteristicsId
, (select VerificationStatusId from CWNS_Migration.Allegation.VerificationStatus where Code = dfrvmi2.DestinationDataFieldReferenceValueCode) VerificationStatusId
, cast(1 as int) SourceSystemId
, cast(src.IDNBR as nvarchar(64)) SourceSystemIdentifier
, src.IDNBR SourceSystemIdentifier_Numeric
, case when src.CRET_DT_TM = '0001-01-01' then null else src.CRET_DT_TM end SourceSystemCreatedDateTime
, (
select
max(pe.PersonId)
from
CWNS_Migration.PersonIdentity.PersonIdentifier pe
join CHILDSDB2.VLCHA.STAFF_USERID st on cast(st.FK_STAFFFK_PERSID as nvarchar(64)) = pe.Identifier
and pe.PersonIdentificationSystemId = 4
where
st.USERID = ltrim(rtrim(src.CRET_USER_ID))) SourceSystemCreatedPersonId
from
CHILDSDB2.VLCHA.RPT_TRKNG_CHAR src
join CHILDSDB2.VLCHA.ALGTN a on a.FK_RPTRPT_NBR = src.FK_RPTRPT_NBR
join CHILDSDB2.VLCHA.FINDING f on f.FK_ALGTNID = a.IDNBR
join DataCatalog.dbo.DataFieldReferenceValueMappingInfo dfrvmi1 on dfrvmi1.SourceDataFieldReferenceValueDataFieldId = 5438
and dfrvmi1.SourceDataFieldReferenceValueCode = src.FK_TRKNG_CHAR_TCD
and dfrvmi1.DestinationDataFieldReferenceValueDataFieldId = 20586
join DataCatalog.dbo.DataFieldReferenceValueMappingInfo dfrvmi2 on dfrvmi1.SourceDataFieldReferenceValueDataFieldId = 1775
and dfrvmi2.SourceDataFieldReferenceValueCode = f.FINDING_DET_CD
and dfrvmi2.DestinationDataFieldReferenceValueDataFieldId = 55983
)
select
src.*
from
src
left join CWNS_Migration.Allegation.AllegationTrackingCharacteristics tgt on tgt.SourceSystemId = src.SourceSystemId and tgt.SourceSystemIdentifier = src.SourceSystemIdentifier
left join CWNS_Migration.Quarantine.AllegationTrackingCharacteristics q on q.SourceSystemId = src.SourceSystemId and q.SourceSystemIdentifier = src.SourceSystemIdentifier
and q.QExecutionId = 1
where
q.QExecutionId is null
and (
isnull(src.AllegationId, 0) <> isnull(tgt.AllegationId, 0)
or isnull(src.TrackingCharacteristicsId, 0) <> isnull(tgt.TrackingCharacteristicsId, 0)
or isnull(src.VerificationStatusId, 0) <> isnull(tgt.VerificationStatusId, 0)
or try_cast(isnull(src.SourceSystemCreatedDateTime, '') as datetime) <> isnull(tgt.SourceSystemCreatedDateTime, '')
or isnull(src.SourceSystemCreatedPersonId, '') <> isnull(tgt.SourceSystemCreatedPersonId, '')
);
Add a Database reference to your project:
You will need to refactor your code to use:
[$(*ReferencedDatabaseName*)].schemaName.tableName

While debugging the function breakpoint is not hit

I am using powerbuilder 11.2 and I have a pbl that creates a main screen. The user enters an order number in the textbox and hit enter and it fills in data in the bottom of the screen. I am trying to get debugging to hit a breakpoint in my function but it seems to ignore the breakpoint. Is there a way to break into the function? I have a variable I need to evaluate and I can't seem to get into the function while running. Here is the code:
Decimal{2} ld_total_hrs,ld_load_hrs,ld_unload_hrs
long ll_stops_rowcount, ll_row, ll_type, ll_ord_number, ll_rd_rowcount
datetime ldt_1st_stop, ldt_last_stop, ldt_start_time, ldt_end_time, ldt_deliver_time
string ls_dest_id, ls_type, ls_pay_id, ls_ref_number, ls_pay_leg_config
boolean lb_first_drop = TRUE
ld_load_hrs = 0
ld_unload_hrs = 0
SetNull(ldt_deliver_time)
ll_stops_rowcount = dw_trip.RowCount()
If ll_stops_rowcount < 1 then Return 0
For ll_row = 1 to ll_stops_rowcount
If ll_row = 1 then
ldt_1st_stop = dw_trip.GetItemDateTime ( 1, "stops_stp_arrivaldate" )
End if
If dw_trip.GetItemString(ll_row,"stops_stp_type") = "PUP" then
ldt_start_time = dw_trip.GetItemDateTime(ll_row,"stops_stp_arrivaldate")
ldt_end_time = dw_trip.GetItemDateTime(ll_row,"stops_stp_departuredate")
ld_load_hrs = ld_load_hrs + (f_datetimediff(ldt_start_time,ldt_end_time)/60)/60
End if
If dw_trip.GetItemString(ll_row,"stops_stp_type") = "DRP" then
ldt_start_time = dw_trip.GetItemDateTime(ll_row,"stops_stp_arrivaldate")
ldt_end_time = dw_trip.GetItemDateTime(ll_row,"stops_stp_departuredate")
ld_unload_hrs = ld_unload_hrs + (f_datetimediff(ldt_start_time,ldt_end_time)/60)/60
// get the first drops info for the report if paylegaslane is true else get last drop
ls_pay_leg_config = is_PayLegConfig
If is_CompanyOverride=true then
ls_pay_leg_config = "ByLeg"
End if
//TGRIFFIT - PayLegConfig = 'ByLeg' in TMW is equivalent to 'PayLegAsLane = 'Y' in FSS
if Upper(ls_pay_leg_config) = 'BYLEG' then
If lb_first_drop Then
ldt_deliver_time = ldt_end_time
ls_dest_id = dw_trip.GetItemString(ll_row,"stops_cmp_id")
ls_ref_number = dw_trip.GetItemString(ll_row,"stops_stp_refnum")
lb_first_drop = FALSE
End if
else
ldt_deliver_time = ldt_end_time
ls_dest_id = dw_trip.GetItemString(ll_row,"stops_cmp_id")
ls_ref_number = dw_trip.GetItemString(ll_row,"stops_stp_refnum")
end if
End if
Next
ldt_last_stop = dw_trip.GetItemDateTime ( ll_stops_rowcount, "stops_stp_departuredate" )
ld_total_hrs = (f_datetimediff(ldt_1st_stop,ldt_last_stop)/60)/60
ll_ord_number = long(dw_triptab.GetItemString(1,"ord_number"))
//If g_messlevel% < 1 Then
if gnv_app.ii_MessLevel < 1 Then
ids_revdist.Reset()
End if
//Load the datastore that stores all the revenue distribution values
ll_rd_rowcount = ids_revdist.RowCount()
ids_revdist.InsertRow(0)
ll_rd_rowcount ++
ids_revdist.SetItem(ll_rd_rowcount,"mov_number",i_movenum%)
ids_revdist.SetItem(ll_rd_rowcount,"lgh_number",dw_trip.GetItemNumber(1,"stops_lgh_number"))
ids_revdist.SetItem(ll_rd_rowcount,"total_hours",ld_total_hrs)
ids_revdist.SetItem(ll_rd_rowcount,"load_hours",ld_load_hrs)
ids_revdist.SetItem(ll_rd_rowcount,"unload_hours",ld_unload_hrs)
ids_revdist.SetItem(ll_rd_rowcount,"deliver_date",ldt_deliver_time)
ids_revdist.SetItem(ll_rd_rowcount,"dest_code",ls_dest_id)
ids_revdist.SetItem(ll_rd_rowcount,"ref_number",ls_ref_number)
Return ids_revdist.RowCount()
I need to evaluate this line specifically and I set a breakpoint at this line:
ls_pay_leg_config = "ByLeg"
as well as the following lines. It does not break. I am rusty at PowerBuilder and can figure this out.
Put the breakpoint at the start of the loop.

Bad Request error when calling HTTP_POST?

I have a question about the SAP Function Module "http_post".
I just want to post a short message (msg) out of the SAP to a Push Notification Server (pushd-Github-Projekt) I installed before. Now I'm not sure how to pass the message.
I tested the FM with the test-symbol:
CALL FUNCTION 'HTTP_POST'
exporting
ABSOLUTE_URI = uri " Uniform Resource Identifier (RFC 1945)
* REQUEST_ENTITY_BODY_LENGTH = 14 "request_entity_body_length
* RFC_DESTINATION = " RFC Destination
* PROXY = " HTTP Proxy Rechner
* PROXY_USER = " Benutzername auf dem Proxy Rechner
* PROXY_PASSWORD = " Passwort auf dem Proxy Rechner
* USER = " Benutzername auf dem HTTP Server
* PASSWORD = " Passwort auf dem HTTP Server
* BLANKSTOCRLF = " Blanks in CRLF konvertieren im Entity Body
* importing
* STATUS_CODE = " Statuscode ( 2xx = OK )
* STATUS_TEXT = " Text zum Statuscode
* RESPONSE_ENTITY_BODY_LENGTH = " Länge vom Response-Entity-Body
tables
REQUEST_ENTITY_BODY = '{"msg":"test"}' "request_entity_body
RESPONSE_ENTITY_BODY = '' " Response-Entity-Body Daten
RESPONSE_HEADERS = '' " Header Zeilen vom Response
REQUEST_HEADERS = 'Content-Type: application/json' "request_headers
* exceptions
* CONNECT_FAILED = 1
* TIMEOUT = 2
* INTERNAL_ERROR = 3
* TCPIP_ERROR = 4
* SYSTEM_FAILURE = 5
* COMMUNICATION_FAILURE = 6
* OTHERS = 7
.
I know my values are no tables, but I tested it with the test-symbol, where you can write the values directly in a table.
When I start the FM, I get an Bad Request error in the SAP
and this error at the push notification server:
SyntaxError: Unexpected token
at Object.parse (native)
at IncomingMessage.<anonymous> ...Path from the pushd..
express\node_modules\connect\lib\middleware\json.js:76:27
at incomingMessage.EventEmitter.emit events.js:92:17
at _stream:readable.js:919:16
at process._tickCallback <node.js:419:13>
Can anyone help me how to pass the request to the FM HTTP-Post? It has to be sth. with msg, because otherwise the Push-Notification-Server can't handle it.
In SAP_BASIS release 731 or higher, I would strongly recommend to use the class CL_HTTP_CLIENTfor doing HTTP requests. See here an example report on how to do it. Replace the dummy string http:1.2.3.4:80/testjon/by your URL in question.
report z_test_http_post.
start-of-selection.
perform start.
* ---
form start.
data: lv_status type i,
lv_error_occurred type flag,
lv_error_msg type string,
lv_response_body type string.
perform send_json using
'http://1.2.3.4:80/testjson/' " Use your URL here
'{"hello":"world"}' " Use your JSON here
changing lv_status lv_response_body
lv_error_occurred
lv_error_msg.
* Show result
format color col_heading.
write: / 'Response status:', lv_status.
if lv_error_occurred = 'X'.
format color col_negative.
write: / 'Error occurred:', lv_error_msg.
endif.
format color col_normal.
write: / 'Response:', lv_response_body.
endform. "start
form send_json using iv_url type string
iv_json_data type string
changing cv_status type i
cv_response_body type string
cv_error_occurred type flag
cv_error_msg type string.
data: lo_client type ref to if_http_client.
clear: cv_error_msg,
cv_status,
cv_error_occurred,
cv_error_msg.
if iv_url is initial.
* No URL passed
message e349(sbds) into cv_error_msg.
cv_error_occurred = 'X'.
return.
endif.
call method cl_http_client=>create_by_url
exporting
url = iv_url
importing
client = lo_client
exceptions
argument_not_found = 1
plugin_not_active = 2
internal_error = 3
others = 4.
if sy-subrc ne 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
into cv_error_msg.
cv_error_occurred = 'X'.
return.
endif.
lo_client->request->set_cdata( iv_json_data ).
lo_client->request->set_content_type( 'application/json' ).
lo_client->request->set_method( 'POST' ).
call method lo_client->send
exceptions
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
others = 4.
if sy-subrc ne 0.
lo_client->get_last_error( importing message = cv_error_msg ).
cv_error_occurred = 'X'.
return.
endif.
lo_client->receive( exceptions others = 1 ).
if sy-subrc ne 0.
lo_client->get_last_error( importing message = cv_error_msg ).
cv_error_occurred = 'X'.
return.
endif.
cv_response_body = lo_client->response->get_cdata( ).
lo_client->response->get_status( importing code = cv_status ).
endform.

MP0303_SyncAssetEquipment - Commission Date field cannot be blank

I am getting the following error using infor-eam MP0303_SyncAssetEquipment:
"Commission Date field cannot be blank."
I have coded for the commission date:
getrequest.AssetEquipment.COMMISSIONDATE = new MP0303_SyncAssetEquipment_001.DATETIME();
getrequest.AssetEquipment.COMMISSIONDATE.YEAR = result.AssetEquipment.COMMISSIONDATE.YEAR;
getrequest.AssetEquipment.COMMISSIONDATE.MONTH = result.AssetEquipment.COMMISSIONDATE.MONTH;
getrequest.AssetEquipment.COMMISSIONDATE.DAY = result.AssetEquipment.COMMISSIONDATE.DAY;
getrequest.AssetEquipment.COMMISSIONDATE.HOUR = result.AssetEquipment.COMMISSIONDATE.HOUR;
getrequest.AssetEquipment.COMMISSIONDATE.MINUTE = result.AssetEquipment.COMMISSIONDATE.MINUTE;
getrequest.AssetEquipment.COMMISSIONDATE.SECOND = result.AssetEquipment.COMMISSIONDATE.SECOND;
getrequest.AssetEquipment.COMMISSIONDATE.SUBSECOND = result.AssetEquipment.COMMISSIONDATE.SUBSECOND;
getrequest.AssetEquipment.COMMISSIONDATE.TIMEZONE = result.AssetEquipment.COMMISSIONDATE.TIMEZONE;
But still getting the same error message. Any ideas?
Thanks Before Hand
You are missing these:
getrequest.AssetEquipment.COMMISSIONDATE.qualifier = new MP0303_SyncAssetEquipment_001.DATETIMEqual();
getrequest.AssetEquipment.COMMISSIONDATE.qualifier = (MP0303_SyncAssetEquipment_001.DATETIMEqual)result.AssetEquipment.COMMISSIONDATE.qualifier;

Resources