Connecting Fiscal printer with flutter app - flutter

I'm working on a kitchen app in flutter. So I need to connect different types of printers to get the KOT and customer prints.
I've already connected
EPSON thermal printers
Starmonics TSP100III
Bluetooth printers
SUNMI printers
But not able to connect FISCAL printers. It gets connected with the flutter app via Bluetooth but doesn't take a printout
gives the exception: Unimplemented/Unsupported command
Is there any way to connect fiscal printers with flutter app?

I think you can try this but I don't know if it works

I think the solution is to implement http Request, this is an Example that I finded this for Printer Epson:
A SOAP message is returned as the response to the HTTP POST method. The SOAP body contains the response document. To permit cross-domain communication, the response contains the HTTP "Access-Control-Allow-Origin: *" header. See Fiscal Printer Intelligent Features Guide for browser cross-domain information.
[Example]
HTTP/1.1 200 OK Access-Control-Allow-Origin: * Content-Type: text/xml; charset=utf-8 Content-Length: xxxx
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<response success="true" code="" status="xxxxx" />
</s:Body> </s:Envelope>

Related

OAuth with Office 365 SOAP returns "The audience claim value is invalid"

I have been trying to integrate Office 365 Exchange services using OAuth for a web app. We already have an integration for on premise and this integration works with Basic [username:password] authentication with https://outlook.office365.com/EWS/Exchange.asmx
Authorization using:
https://login.microsoftonline.com//oauth2/authorize?response_type=code&prompt=consent&client_id=[APP_ID]&redirect_uri=[URL]
Getting token using:
POST
https://login.microsoftonline.com//oauth2/token
Body:
grant_type=authorization_code&code=[Code]&redirect_url=[URL]&scope=https://outlook.office365.com/calendars.readwrite
I was able to get a token successfully.
Application Permissions I set up on Azure App Registration are:
Microsoft Graph Permissions
Read and write user and shared calendars
Read user and shared calendars
Send mail as a user
Read user calendars
Have full access to user calendars
Office 365 Exchange Online Permissions
Read user and shared calendars
Read and write user and shared calendars
Send mail as a user
Read user calendars
Read and write user calendars
With the token I acquire, I am trying to create an event using;
https://outlook.office365.com/EWS/Exchange.asmx
Header:
POST /EWS/Exchange.asmx HTTP/1.1
Host: outlook.office365.com
client_request_id: [random_guid]
User-Agent: APPName
Authorization: Bearer [TOKEN]
Body:
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<soap:Header>
<t:RequestServerVersion Version="Exchange2016"/>
</soap:Header>
<soap:Body>
<m:CreateItem SendMeetingInvitations="SendToAllAndSaveCopy">
<m:Items>
<t:CalendarItem>
<t:Subject>Test Event</t:Subject>
<t:Body BodyType="HTML">Test Body</t:Body>
<t:Start>2018-11-17T08:00:00.000</t:Start>
<t:End>2018-11-17T09:00:00.000</t:End>
<t:StartTimeZone Id="Pacific Standard Time"/>
<t:EndTimeZone Id="Pacific Standard Time"/>
</t:CalendarItem>
</m:Items>
</m:CreateItem>
This is the response I am getting with status code 401:
Server →Microsoft-IIS/10.0
request-id →b6d17647-5285-4c40-9087-3875958750b2
X-CalculatedFETarget →MWHPR1601CU001.internal.outlook.com
X-BackEndHttpStatus →401
X-BackEndHttpStatus →401
Set-Cookie →exchangecookie=947fe20a28e842068b3fe78a71b4e15b; path=/
X-FEProxyInfo →MWHPR1601CA0011.NAMPRD16.PROD.OUTLOOK.COM
X-CalculatedBETarget →MWHPR2001MB1823.namprd20.prod.outlook.com
X-RUM-Validated →1
x-ms-diagnostics →2000003;reason="The audience claim value is invalid 'aud'.";error_category="invalid_resource"
X-BeSku →Gen9
X-DiagInfo →MWHPR2001MB1823
X-BEServer →MWHPR2001MB1823
X-FEServer →MWHPR1601CA0011
X-FEServer →BYAPR05CA0077
X-Powered-By →ASP.NET
WWW-Authenticate →Bearer client_id="00000002-0000-0ff1-ce00-000000000000", trusted_issuers="00000001-0000-0000-c000-000000000000#*", token_types="app_asserted_user_v1 service_asserted_app_v1", authorization_uri="https://login.windows.net/common/oauth2/authorize", error="invalid_token",Basic Realm="",Basic Realm="",Basic Realm=""
Date →Wed, 14 Nov 2018 22:07:28 GMT
Content-Length →0
I have been reading and making research for the last two days but could not find anything similar where other devs tried same integration.
Could you please advise?
Maybe there is someone who can explain what I am doing wrong.
Thank you!
With EWS you should be requesting a Scope of https://outlook.office365.com/EWS.AccessAsUser.All or https://outlook.office365.com/full_access_as_app if your trying to use AppOnly tokens. The other constrained scopes aren't valid for EWS as its a bit of legacy API in this respect.

Plivo Inbound Sip trunk - issue with destination number

I'm trying to forward calls from few Plivo numbers to my Asterisk server. In Plivo documentation specified, that i have to build Inbound trunk application and return to plivo XML code below:
<Response>
<Dial callerId="18004321321">
<User>sip:yoda12312312#phone.plivo.com</User>
</Dial>
</Response>
But the problem is that i need to add information about destination phone number (cause i have few of them), but can't find the way to do this.
Have you tried this:
<Response>
<Dial callerId="18004321321">
<User>sip:yoda12312312#phone.plivo.com</User>
<Number>180012345678</Number>
</Dial>
</Response>

wso2 ESB request is truncated

i'm using fresh installation of wso2 esb 4.8.1 with stanalone default configuration.
when i send soap request to my backend (perl service with soap lite), the body of POST request is truncated like this according to tcpdump:
SOAPAction: ""
Content-Type: text/xml
Content-Length: 511
Host: 192.168.11.234:8181
Connection: Keep-Alive
User-Agent: Synapse-PT-HttpComponents-NIO
<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="htt
p://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<deleteAccountForHost xmlns="AbcdeHostingPhysicalHostManagerCPanelService">
<host xsi:type="xsd:string">zs000.abcde.net</host>
<user xsi:type="xsd:string">tstauto</user>
</deleteAccountForHost>
</soap:Body>
</soap:Envel
You can see that closing tag '</soap:Envel' is truncated.
But when i enable SOAP-tracer the request body becomes valid.
i use PT transport. I tried to switch transport to the nhttp and this problem seems to be disappeared.
So the question is: how to configure PT transport to avoid such strange behavior?
UPD1:
it seems that the problem occurs only when set the property FORCE_HTTP_1.0 and transport is PT
I got the same problem, but I set DISABLE_CHUNKING.
After many tries I tested that disabling chunking or forcing HTTP 1.0 results in truncated request.
I use WSO2 ESB version 4.8.1, client is SoapUI 5.0.0 or SoapClient from PHP 5.5.11.
When I use "Try this service" in ESB, then request is not truncated.
After switching from HTTP PassThrough Transport to HTTP-NIO Transport service behind endpoint receives complete request, but then I can't download WSDL of tenant.

ServiceStack: Incorrect metadata for SOAP?

I followed the Create your first webservice tutorial. When I go to the Hello Service Soap11 metadata page, I see the following:
POST /xml/reply/Hello HTTP/1.1
Host: localhost
Content-Type: application/xml
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ...
</soap:Envelope>
The line POST /xml/reply/Hello HTTP/1.1 seems incorrect. When I use the Postman Rest Client and post to /xml/reply/hello to test the SOAP endpoint. It doesn't work. The response is a 400 Bad Request with a message "Could not deserialize 'application/xml' request..."
Then I change the URL to make the request post to /soap11 instead, it works with status code 200 OK.
This problem happens for the Soap12 metadata page too.
Seems like something is not right with the metadata page generation?
By looking at the code, this does look like a bug.
I have fixed the problem and submitted a pull request to ServiceStack, pending for acceptance.
Pull request: https://github.com/ServiceStack/ServiceStack/pull/389
Update: Pull request has been merged into ServiceStack master branch. Problem solved!

Invoking external web methods with BPEL + Apache Ode (calling .Net asmx) problems

Pre-info:
I'm learning to use orchestration of web methods(WM). I've sucessfully completed lessons with assings, invoking web methods, some parallel processing in BPEL. I'm using Eclipse Indigo 3.7.1 with BPEL plugins, Tomcat7 server with Apache Ode as orchestration base. At other side I need to learn calling secured WMs written on Mono .Net platform.
Having now:
Now I'm having problem calling ANY web methods. I've made:
1) Web Method running by Mono .Net - works, can be tested with browser (http://localhost:8081/hwws.asmx ) and with Eclipse tool "Web Services Explorer", it works fine.
2) my BPEL that only invokes this .Net web method throught SOAP port.
3) at other work stantion I've made .Net service with Visual Studio. Having errors either, if need I'll post it text later.
Problem: I'm getting errors at invoking.
Screens:
1) browser test of .net WS HW(helloWorld) http :// photo -hosting.winsoftmagic .com/ 1/ s4nbwdsqib.jpg
2) Eclipse test of .net WS HW http://photo-hosting.winsoftmagic.com/1/zywnl2wtgu.jpg
3) Error I get http://photo-hosting.winsoftmagic.com/1/ltbexoxcdl.jpg
Error listing:
18:15:25,294 WARN ExternalService Fault response: faultType=(unkown)
soap:ClientCould not deserialize Soap message
18:15:25,376 ERROR INVOKE Failure during invoke:
18:15:25,382 INFO BpelRuntimeContextImpl ActivityRecovery: Registering activity 11, failure reason: on channel 21
And it's give timeout error later. I've spent a week around this problems already, searched with all ways I could think up.
EDIT 12.03.2012:
Now test with mono WS worked for some reason.
I've tryed call WS from the internet and it gave the same error as I had at work spot:
14:25:16,177 ERROR [INVOKE] Failure during invoke: Error sending message (mex={PartnerRoleMex#hqejbhcnphr747jefui9ic [PID {http://wsaspx.tns/}inetWS-24] calling org.apache.ode.bpel.epr.WSAEndpoint#1e3a4c7.checkText(...) Status ASYNC}): The input stream for an incoming message is null.
14:25:16,178 INFO [BpelRuntimeContextImpl] ActivityRecovery: Registering activity 11, failure reason: Error sending message (mex={PartnerRoleMex#hqejbhcnphr747jefui9ic [PID {http://wsaspx.tns/}inetWS-24] calling org.apache.ode.bpel.epr.WSAEndpoint#1e3a4c7.checkText(...) Status ASYNC}): The input stream for an incoming message is null. on channel 21
In same time this service works from all test forms.
Edit: 16.03.2012
My mono method stopped work same as it started without my understanding. TcpMon-1.1.jar shows such message again:
POST /hwws.asmx HTTP/1.1
Content-Type: text/xml; charset=UTF-8
SOAPAction: "http://hwws.tps/HelloWorld"
User-Agent: Axis2
Host: localhost:8092
Transfer-Encoding: chunked <--- EDITED: REASON OF NOT WORKING ----
31c
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<addr:To xmlns:addr="http://www.w3.org/2005/08/addressing">http://localhost:8092/hwws.asmx</addr:To>
<addr:Action xmlns:addr="http://www.w3.org/2005/08/addressing">http://hwws.tps/HelloWorld</addr:Action>
<addr:ReplyTo xmlns:addr="http://www.w3.org/2005/08/addressing"><addr:Address>http://www.w3.org/2005/08/addressing/anonymous</addr:Address></addr:ReplyTo>
<addr:MessageID xmlns:addr="http://www.w3.org/2005/08/addressing">uuid:hqejbhcnphr74k7fapcntd</addr:MessageID>
</soapenv:Header>
<soapenv:Body><HelloWorld xmlns="http://hwws.tps/">
<s0:st xmlns:s0="http://hwws.tps/">My test message</s0:st>
</HelloWorld></soapenv:Body></soapenv:Envelope>
0
HTTP/1.0 500 Internal Server Error
Date: Fri, 16 Mar 2012 08:01:50 GMT
Server: Mono.WebServer2/0.4.0.0 Unix
Connection: close
X-AspNet-Version: 4.0.30319
Content-Length: 366
Cache-Control: private
Content-Type: text/xml; charset=utf-8
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body><soap:Fault><faultcode>soap:Client</faultcode>
<faultstring>Could not deserialize Soap message</faultstring>
</soap:Fault></soap:Body></soap:Envelope>
Actually I get one of 3 errors: couldn't deserialise, The input stream for an incoming message is null or even error 411 yesterday:) P.s. had 4th error with no socket connecting also, but all them vanished.
My main goal is ssl+authorisation .net services - would be gratefull if you have examples.
Thanks a lot to everyone! It's real pleasure to see your help:)
Thanks to all, testing soap-body shown that it was good and problem was in headers part which had some strange "Chunked" and numbers before xml (length of xml text) and 0 after xml end. I just set http.request.chunk=false and now it work at all my tests yet. For that purpose download sample.endpoint from http://ode.apache.org/endpoint-configuration.html , renamed it as bpel name (MonoCaller.bpel => MonoCaller.endpoint). It has string for chunked already commented. And also added something like http.default-headers.authorization=Basic <64b code of "login:password" made in any coder> for authorization purpose and it also works now! :-]
The same error has occured with me, the problem was with the web service itself, I had an empty constructor plus the methodes wich causes a problem, the solution is to delete the constructor.