Printer error (EX_TIMEOUT) Epson TM-T88V-I with epson.ePOSBuilder - printing

Epson model TM-T88V-i.
Connected to LAN.
Ping response OK.
Printing status sheet OK.
I have access to printer configuration page.
http://192.168.x.x/PrinterConfigurationPage/
In configuration page - section devices raise error in test print button for the printer "local_printer", error: "EX_TIMEOUT A time-out ocurred".
reference (ePOS-Print API/XML):
https://download.epson-biz.com/modules/community/index.php?content_subject=ePOS-Print%20API/XML
simple test web site:
print.html
<script type="text/javascript" src="js/epos-print-3.0.0.js"></script>
code
function printTest() {
// open print dialog
$('#print').dialog('open');
//
// build print data
//
// create print data builder object
var builder = new epson.ePOSBuilder();
builder.addText('Test Print\n');
builder.addFeedLine(1);
// append paper cutting
builder.addCut();
//
// send print data
//
// create print object
var url = 'http://192.168.x.x/cgi-bin/epos/service.cgi?devid=local_printer&timeout=6000';
var epos = new epson.ePOSPrint(url);
// register callback function
epos.onreceive = function (res) {
// close print dialog
$('#print').dialog('close');
// print failure
if (!res.success) {
// show error message
$('#receive').dialog('open');
}
}
// register callback function
epos.onerror = function (err) {
// close print dialog
$('#print').dialog('close');
// show error message
$('#error').dialog('open');
}
// send
epos.send(builder.toString());
}
Request to service.cgi :
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<epos-print xmlns="http://www.epson-pos.com/schemas/2011/03/epos-print">
<text>Test Print!!
</text>
<feed line="1"/>
<cut/>
</epos-print>
</s:Body>
</s:Envelope>
Response: epson api manual (status: 0x00000001 = No response from the TM printer)
<?xml version="1.0" encoding="UTF-8" ?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<response success="false" code="EX_TIMEOUT" status="1" xmlns="http://www.epson-pos.com/schemas/2011/03/epos-print" />
</soapenv:Body>
</soapenv:Envelope>
when i change the service url a other device
var url = 'http://192.168.x.x/cgi-bin/epos/service.cgi?devid=other_printer&timeout=6000';
Request correct
Sucess="False" code="DeviceNotFound" status="0"
Windows Application example the same response:
Public Class Form1
' URL of ePOS-Print supported TM printer
Private address As String = "http://192.168.x.x/cgi-bin/epos/service.cgi?devid=local_printer&timeout=10000"
' XML namespace
Private soap As XNamespace = "http://schemas.xmlsoap.org/soap/envelope/"
Private epos As XNamespace = "http://www.epson-pos.com/schemas/2011/03/epos-print"
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
' Create print document
Dim req As XElement = _
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<epos-print xmlns="http://www.epson-pos.com/schemas/2011/03/epos-print">
<text lang="en" smooth="true">Intelligent Printer
</text>
<cut/>
</epos-print>
</s:Body>
</s:Envelope>
' Send print document
Dim client As WebClient = New WebClient()
client.Headers.Set("Content-Type", "text/xml; charset=utf-8")
AddHandler client.UploadStringCompleted, AddressOf UploadStringCompletedEventHandler
client.UploadStringAsync(New Uri(address, UriKind.Absolute), req.ToString())
End Sub
' Receive response document
Private Sub UploadStringCompletedEventHandler(sender As Object, e As UploadStringCompletedEventArgs)
If (e.Error IsNot Nothing) Then
MessageBox.Show(e.Error.Message)
Else
'Parse response document
Dim res As XElement = XElement.Parse(e.Result)
Dim c = From el In res.Descendants(epos + "response") Select el.Attribute("success")
MessageBox.Show(c.First().Value)
End If
End Sub
End Class

Two possibilities:
Your printer has a device id that is different from local_printer - check the configuration page.
Or the ePOSPrint() function does not allow sending the url directly. What I have on my first test page (I'm working on building an app for the same printer right now) looks different than on yours:
var epos = new epson.ePOSPrint();
epos.address = 'http://192.168.0.1/cgi-bin/epos/services.cgi?devid=local_printer&timeout=6000';
Note the empty () and how the url is delivered after initialization.
After checking, it looks like some other test code I have does submit the url as parameter to the function like you have it, so my only guess is that the device id local_printer is incorrect.

Related

DocuSign Connect Listener MVC5 Api

I have the following MVC 5 Rest Controller:
namespace Rest4.Controllers
{
public class DocuSignController : ApiController
{
// POST api/docusign
public void Post([FromBody]DocuSignAPI.DocuSignEnvelopeInformation DocuSignEnvelopeInformation)
{
try
{
System.Xml.Serialization.XmlSerializer ser = new System.Xml.Serialization.XmlSerializer(typeof(DocuSignAPI.DocuSignEnvelopeInformation));
XmlSerializer serializer = new XmlSerializer(typeof(DocuSignAPI.DocuSignEnvelopeInformation));
StringBuilder sb = new StringBuilder();
using (StringWriter writer = new StringWriter(sb))
{
serializer.Serialize(writer, DocuSignEnvelopeInformation);
}
string fileName = DateTime.Now.Ticks.ToString();
using (StreamWriter outputFile = new StreamWriter(string.Format(#"c:\clientuploads\{0}.xml", fileName)))
{
outputFile.WriteLine(sb.ToString());
outputFile.WriteLine("Nothing to see here");
}
}
catch { }
}
However, when I go to the DocuSign Connect Settings and try to send the same, all I get is:
<?xml version="1.0" encoding="utf-16"?>
<DocuSignEnvelopeInformation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:nil="true" />
Nothing to see here
However, if I look at the logs on the DocuSign site:
1/28/2016 8:49:56 PM Connect send to: http://somewhere.com/Rest/api/DocuSign
1/28/2016 8:49:56 PM Envelope Data (documents were included):<?xml version="1.0" encoding="utf-8"?><DocuSignEnvelopeInformation xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.docusign.net/API/3.0"><EnvelopeStatus><RecipientStatuses><RecipientStatus><Type>Signer</Type><Email>someemailaddress</Email><UserName>somebody</UserName><RoutingOrder>1</RoutingOrder><Sent>2016-01-13T10:35:11.16</Sent>....<Sequence>4</Sequence></DocumentStatus></DocumentStatuses></EnvelopeStatus></DocuSignEnvelopeInformation>
So, why is the document I get from DocuSign empty? Is there a better way to capture the info? If I try Post([FromBody]string DocuSignEnvelopeInformation) instead, I get a 500 Error on the DocuSign site
Did you specify the default name space while initializing serializer as follows.
XmlSerializer serializer = new XmlSerializer(typeof(DocuSignEnvelopeInformation), "http://www.docusign.net/API/3.0");
DocuSignEnvelopeInformation envelopeInfo = serializer.Deserialize(reader) as DocuSignEnvelopeInformation;

TwiML App unexpected end of call: Cannot find the declaration of element 'response'

I created TwiML application and set Voice request URL the web deployed ASP.NET-MVC aplication action method: http://voiceapp-001-site1.myasp.net/voice
This action method is invoked when somebody goes to the URL posted above:
public ActionResult Voice() {
Response.ContentType = "text/xml";
// put a phone number you've verified with Twilio to use as a caller ID number
string callerId = Settings.TwilioNumber;
// put your default Twilio Client name here, for when a phone number isn't given
string number = "jenny";
// get the phone number from the page request parameters, if given
if (Request["PhoneNumber"] != null) {
number = Request["PhoneNumber"];
}
// wrap the phone number or client name in the appropriate TwiML verb
// by checking if the number given has only digits and format symbols
string numberOrClient;
var m = Regex.Match(number, #"^[\d\+\-\(\) ]+$");
if (m.Success) {
numberOrClient = string.Format("<Number>{0}</Number>", number);
} else {
numberOrClient = string.Format("<Client>{0}</Client>", number);
}
ViewBag.CallerId = callerId;
ViewBag.NumberOfClient = numberOrClient;
return View();
}
The Voice view looks like:
<?xml version="1.0" encoding="UTF-8" ?>
<response>
<dial callerid="#ViewBag.CallerId">
#Html.Raw(ViewBag.NumberOfClient)
</dial>
</response>
Then I try to make test call:
but after 13 seconds call is automatically terminated and In the error log I get:
Notification SID NOe85ffe80dfc52e81f942a7414c9f7c9c
Warning 12200 Schema validation warning
Description Cannot find the declaration of element 'response'.
But below in the Body section I can see the element response:
Hi Twilio developer evangelist here.
Can you try modifying your view to look like this instead?
<?xml version="1.0" encoding="UTF-8" ?>
<Response>
<Dial callerId="#ViewBag.CallerId">
#Html.Raw(ViewBag.NumberOfClient)
</Dial>
</Response>
Remember XML is case-sensitive, so the casing in your XML tags actually matter. Also, I would suggest using the Twilio.TwiML helper library. With that, you can get your XML generated for you with the right casing, and avoiding typos altogether.
Here's how you'd do it:
var twiml = new TwilioResponse();
var dialAttributes = new {callerId = "48326304351"};
var dial = twiml.Dial("+15555555555", dialAttributes);
return TwiML(dial);

The conference doesnt work in twilio

I implemented conference call in Twilio, but it doesn't work. The error is:
Error: 11200 HTTP retrieval failure
In more details :
405 - HTTP verb used to access this page is not allowed.
Code:
string AccountSid = "...";
string AuthToken = ".....";
var twilio = new TwilioRestClient(AccountSid, AuthToken);
string appversion = twilio.ApiVersion;
ArrayList participants = new ArrayList();
// participants.Add("+972599223072");
participants.Add(txtphone1.Text);
participants.Add(txtphone2.Text);
participants.Add(txtphone3.Text);
participants.Add(txtphone4.Text);
participants.Add(txtphone5.Text);
participants.Add(txtphone6.Text);
participants.Add(txtphone7.Text);
// Go through the participants array and call each person.
foreach (string user in participants)
{
if (user != "")
{
var options = new CallOptions();
options.Url = "http://sandbox4.eureeca.com/Conference/conference.xml";
options.To = user;
options.From = "+97243741357";
options.Method = "POST";
options.Record = true;
// options.StatusCallback = "/2010-04-01/Accounts/" + AccountSid + "/Calls";
var call = twilio.InitiateOutboundCall(options);
Console.WriteLine(call.Sid);
}
Code END
Conference.xml content :
<?xml version="1.0" encoding="utf-8" ?>
<Response>
<Say>Joining a conference room</Say>
<Dial>
<Conference>MyConference</Conference>
</Dial>
</Response>
Twilio evangelist here.
Looks like you're TwiML is in a static XML file? Its pretty common for web servers to not allow POST requests to static files. You can either reconfigure your web server to allow this, or change the CallOptions Method property to `GET' to tell Twilio to make a GET request for the file rather than a POST.
Hope that helps.

Creating soap request with http build

Im trying to make a soap request using httpbuilder. I need to pass some authentication parameters in the head section.
My code is as follows
def String WSDL_URL = 'http://ws.tradetracker.com/soap/affiliate?wsdl'
def http = new HTTPBuilder( WSDL_URL , ContentType.TEXT )
String soapEnvelope =
"""<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap-env:Header>
<authenticate>
<customerID>id</customerID>
<passphrase>pass</passphrase>
<demo>true</demo>
</authenticate>
</soap-env:Header>
<soap12:Body>
<getConversionTransactions xmlns="xmlns':'http://schemas.xmlsoap.org/wsdl">
<affiliateSiteID>id</affiliateSiteID>
</getConversionTransactions>
</soap12:Body>
</soap12:Envelope>"""
http.request( Method.POST, ContentType.TEXT ) {
body = soapEnvelope
response.success = { resp, xml ->
String xm = xml.readLines()
println "XML was ${xm}"
def territories = new XmlSlurper().parseText(
'<?xml version="1.0" encoding="UTF-8"?> <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="urn:http://ws.webgains.com/aws.php" xmlns:enc="http://www.w3.org/2003/05/soap-encoding" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><env:Body xmlns:rpc="http://www.w3.org/2003/05/soap-rpc"><ns1:getFullUpdatedEarningsResponse env:encodingStyle="http://www.w3.org/2003/05/soap-encoding"><rpc:result>return</rpc:result><return enc:itemType="ns1:fullLinesArray" enc:arraySize="1" xsi:type="ns1:fullReportArray"><item xsi:type="ns1:fullLinesArray"><transactionID xsi:type="xsd:int">39367137</transactionID><affiliateID xsi:type="xsd:int">59987</affiliateID><campaignName xsi:type="xsd:string">www.tikcode.com</campaignName><campaignID xsi:type="xsd:int">136755</campaignID><date xsi:type="xsd:dateTime">2013-05-13T15:04:48</date><validationDate xsi:type="xsd:dateTime">2013-05-13T15:04:48</validationDate><delayedUntilDate xsi:type="xsd:string"></delayedUntilDate><programName xsi:type="xsd:string">Miniinthebox - US</programName><programID xsi:type="xsd:int">4611</programID><linkID xsi:type="xsd:string">95661</linkID><eventID xsi:type="xsd:int">7285</eventID><commission xsi:type="xsd:float">0.06</commission><saleValue xsi:type="xsd:float">0.8</saleValue><status xsi:type="xsd:string">confirmed</status><paymentStatus xsi:type="xsd:string">notcleared</paymentStatus><changeReason xsi:nil="true"/><clickRef xsi:nil="true"/><clickthroughTime xsi:type="xsd:dateTime">2013-05-13T14:58:33</clickthroughTime><landingPage xsi:type="xsd:string">http%3A%2F%2Fwww.lightinthebox.com%2Fes%2F%3Flitb_from%3Daffiliate_webgains</landingPage><country xsi:type="xsd:string">ES</country><referrer xsi:type="xsd:string">http%3A%2F%2Flocalhost%3A8080%2Fcom.publidirecta.widget%2Fpromocion%2FverPromocion%3Fpromocion%3D</referrer></item></return></ns1:getFullUpdatedEarningsResponse></env:Body></env:Envelope>').declareNamespace("ns1":"http://ws.webgains.com/aws.php")
println "aaaaaaaaaaaaaaaa"+ territories.Body.getFullUpdatedEarningsResponse.return.item.transactionID
}
response.failure = { resp, xml ->
println "pues peto, no se porque"+xml.readLines()
}
}
Im getting the following error and I dont have any clue wants wrong
<?xml version="1.0" encoding="UTF-8"?>, <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body><env:Fault><env:Code><env:Value>env:Sender</env:Value></env:Code><env:Reason><env:Text>Body must be present in a SOAP envelope</env:Text></env:Reason></env:Fault></env:Body></env:Envelope>
Namespace for Envelope and its corresponding Header element is mismatching.
<soap12:Envelope> should have <soap12:Header> instead you have <soap-env:Header>. The payload becomes invalid in the header element so body becomes unreachable.
Like #dmahapatro said you have a problem in your XML. Anyway checking your code I've noted that you are using HTTPBuilder directly. Maybe you can try to use groovy-wslite (https://github.com/jwagenleitner/groovy-wslite) to make SOAP requests. It's very simple to call and process the response. There is a plugin for Grails, despite I'm not using the plugin, but the groovy-wslite directly.
BuildConfig.groovy
dependencies {
compile 'com.github.groovy-wslite:groovy-wslite:0.7.2'
runtime 'com.github.groovy-wslite:groovy-wslite:0.7.2'
}
In a Grails Service for instance:
def cnpj = "999999999906"
def clientSOAP = new SOAPClient('https://www.soawebservices.com.br/webservices/producao/cdc/cdc.asmx')
def response = clientSOAP.send (SOAPVersion.V1_2,
"""<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<PessoaJuridicaNFe xmlns="SOAWebServices">
<Credenciais>
<Email>xxxxx</Email>
<Senha>xxxxx</Senha>
</Credenciais>
<Documento>${cnpj}</Documento>
</PessoaJuridicaNFe>
</soap12:Body>
</soap12:Envelope>"""
)
//processing the response (very simple...)
Client client = new Client()
client.webServiceMsg = response.PessoaJuridicaNFeResponse.PessoaJuridicaNFeResult.Mensagem.text()
client.nome = response.PessoaJuridicaNFeResponse.PessoaJuridicaNFeResult.RazaoSocial.text()
//etc...

Passing an array inside the "parameters" of adapter in Worklight

The code part:
function PushRequests(strUser, eClientType, iSectorId, strDeviceId, arrRequests) {
var input = {
method : 'post',
returnedContentType : 'xml',
path : 'SomeAddress/PushRequests',
parameters : {
'strUser' : strUser.toString(),
'eClientType' : eClientType.toString(),
'iSectorId' : iSectorId.toString(),
'strDeviceId' : strDeviceId.toString(),
'arrRequests' : arrRequests // <- the array
}
};
return WL.Server.invokeHttp(input);
}
The response:
Procedure invocation error. Content is not allowed in prolog.,Failed to parse the payload from backend (procedure: HttpRequest)
I have tried to strignify the array by the navite way and via JSON. This is not the solution.
I know the problem is with the array passed. Does anybody know a workaround, or a way to correctly pass an array to the adapter?
I know the problem is with the array passed.
How do you know this?
Content is not allowed in prolog.
This is almost always a symptom of passing data to an XML parser that is invalid XML, or has some characters before the prolog, which is:
<?xml version="1.0" encoding="utf-8"?>
In your adapter, you've told it to expect XML from the backend HTTP service you're calling. I was able to reproduce the same message you see by returning invalid XML from my backend HTTP service. In fact, I can put anything in the response that is invalid XML, and I'll get the "Content is not allowed in prolog." message. I can return a page that is a 404 page, or with a Content-Type header of "text/plain". The adapter was told to expect XML, but given something else.
Please be sure to check that you are not getting a 404 page, or 500, or something else from the backend HTTP service your adapter is calling.
Here's how I reproduced the "Content is not allowed in prolog" message from my adapter:
First, create an adapter with xmltester.xml:
<wl:adapter name="xmltester"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wl="http://www.worklight.com/integration"
xmlns:http="http://www.worklight.com/integration/http">
<displayName>xmltester</displayName>
<description>xmltester</description>
<connectivity>
<connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
<protocol>http</protocol>
<domain>localhost</domain>
<port>3000</port>
</connectionPolicy>
<loadConstraints maxConcurrentConnectionsPerNode="2" />
</connectivity>
<procedure name="getStuff"/>
</wl:adapter>
and xmltester-impl.js:
function getStuff() {
var input = {
method : 'get',
returnedContentType : 'xml',
path : 'index.xml',
parameters : {
'arrRequests' : JSON.stringify(['one', 'two'])
}
};
return WL.Server.invokeHttp(input);
}
I created a node server (server.js) to be my backend:
var express = require('express');
var app = express();
var port = 3000;
app.get('/index.xml', function(req, res){
var body = '<?xml version="1.0" encoding="utf-8"?><boo/>';
res.setHeader('Content-Type', 'application/xml');
res.setHeader('Content-Length', body.length);
res.end(body);
});
app.listen(port);
console.log('Listening on port %s', port);
Started the server:
npm install express
node server.js
Then created a Worklight app with a button:
<button id="doit">Do it!</button>
And linked up a click listener to see what I get back from Worklight when the adapter is invoked:
$ = WLJQ;
$("#doit").click(function() {
var invocationData = {
adapter : 'xmltester',
procedure : 'getStuff',
parameters : []
};
WL.Client.invokeProcedure(invocationData,{
onSuccess : function(data) {alert("SUCCESS" + JSON.stringify(data));},
onFailure : function(data) {alert("FAILURE" + JSON.stringify(data));}
});
return false;
});
I could recreate the problem exactly when my backend server returned a payload with extra characters in front of the prolog (which you can try yourself by editing the server.js code above), like:
somethinghere<?xml version="1.0" encoding="utf-8"?>
Or any non-XML payload, for that matter.
returnedContentType : 'xml'
Failed to parse the payload from backend
Is the returned content in xml format? If not, can you cange the returnedContentType field to 'plain' or 'html' or whichever format you are expecting it in?

Resources