Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send from phase4 to peppolnext #132

Open
michielbdejong opened this issue Jun 27, 2022 · 6 comments
Open

Send from phase4 to peppolnext #132

michielbdejong opened this issue Jun 27, 2022 · 6 comments

Comments

@michielbdejong
Copy link
Member

michielbdejong commented Jun 27, 2022

Trying something like:

docker run --name=client -e "AS4_END_POINT=https://nc2.docker/index.php/apps/peppolnext/api/v1" --network=testnet client

But I think that's an API endpoint to be used from the GUI by the logged in user, not the endpoint to which an invoice would be sent. Maybe that was not even implemented yet?

@michielbdejong
Copy link
Member Author

hm, I added @publicpage etc as per https://docs.nextcloud.com/server/latest/developer_manual/basics/controllers.html#authentication but still seeing:

curl -X POST -d'hello world' https://nc2.docker/index.php/apps/peppolnext/api/v1/as4

{"message":"Current user is not logged in"}

@michielbdejong
Copy link
Member Author

Sending AS4 UserMessage to
'https://nc2.docker/index.php/apps/peppolnext/api/v1/as4' with max. 1 retries

@michielbdejong
Copy link
Member Author

I can see the POST coming in in the nc2.docker error logs when I do the curl command but not when I run the Phase4 client.

@michielbdejong
Copy link
Member Author

Tried both

docker run --name=client -e "AS4_END_POINT=https://nc2.docker/index.php/apps/peppolnext/api/v1" --network=testnet client

and

docker run --name=client -e "AS4_END_POINT=http://nc2.docker/index.php/apps/peppolnext/api/v1" --network=testnet client

but they just seem to hang (even longer than 5 minutes)

@michielbdejong
Copy link
Member Author

Ah!
After I think 20 minutes:

661338 [main] INFO com.helger.phase4.util.AS4ResourceHelper - Converting [[Chunked: false]; MimeMsg=[com.helger.phase4.messaging.mime.AS4MimeMessage@1b9ea3e3; IsRepeatable=false]] to a repeatable HTTP entity using file /tmp/phase4-res-3166834033756958883.tmp
661379 [main] INFO com.helger.phase4.dump.AS4OutgoingDumperFileBased - Logging outgoing AS4 message to '/root/phase4/phase4-peppol-client/phase4-dumps/outgoing/2022/06/27/[email protected]'
661381 [main] INFO com.helger.phase4.http.BasicHttpPoster - Starting to transmit AS4 Message to 'http://nc2.docker/index.php/apps/peppolnext/api/v1/as4'
661540 [main] INFO com.helger.phase4.http.BasicHttpPoster - Finished transmitting AS4 Message to 'http://nc2.docker/index.php/apps/peppolnext/api/v1/as4' after 159 ms
661541 [main] INFO com.helger.phase4.sender.AS4BidirectionalClientHelper - Successfully transmitted AS4 UserMessage with message ID 'e33a5f11-c717-4c09-be78-ddb41ce1c9b9@phase4' to 'http://nc2.docker/index.php/apps/peppolnext/api/v1/as4'
661542 [main] INFO com.helger.phase4.dump.AS4RawResponseConsumerWriteToFile - Logging AS4 response to '/root/phase4/phase4-peppol-client/phase4-dumps/outgoing/2022/06/27/[email protected]'
661560 [main] INFO com.helger.phase4.dump.AS4IncomingDumperFileBased - Logging incoming AS4 message to '/root/phase4/phase4-peppol-client/phase4-dumps/incoming/2022/06/27/145835-d6d9761d-ed85-4751-8b06-7e2eef4d63c5.as4in'
661578 [main] ERROR com.helger.xml.sax.LoggingSAXErrorHandler - [fatal_error] @ (1:1) [SAX] Content is not allowed in prolog. (org.xml.sax.SAXParseException: Content is not allowed in prolog.)
661580 [main] ERROR com.helger.commons.callback.exception.LoggingExceptionCallback - [error] @ (1:1) [SAX] Content is not allowed in prolog. (org.xml.sax.SAXParseException: Content is not allowed in prolog.)
org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
	at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
	at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
	at com.helger.xml.serialize.read.DOMReader.readXMLDOM(DOMReader.java:325)
	at com.helger.xml.serialize.read.DOMReader.readXMLDOM(DOMReader.java:99)
	at com.helger.xml.serialize.read.DOMReader.readXMLDOM(DOMReader.java:89)
	at com.helger.phase4.servlet.AS4IncomingHandler.parseAS4Message(AS4IncomingHandler.java:265)
	at com.helger.phase4.servlet.AS4IncomingHandler._parseMessage(AS4IncomingHandler.java:736)
	at com.helger.phase4.servlet.AS4IncomingHandler.parseSignalMessage(AS4IncomingHandler.java:764)
	at com.helger.phase4.sender.AS4BidirectionalClientHelper.sendAS4UserMessageAndReceiveAS4SignalMessage(AS4BidirectionalClientHelper.java:150)
	at com.helger.phase4.sender.AbstractAS4UserMessageBuilderMIMEPayload.mainSendMessage(AbstractAS4UserMessageBuilderMIMEPayload.java:123)
	at com.helger.phase4.sender.AbstractAS4MessageBuilder.sendMessage(AbstractAS4MessageBuilder.java:598)
	at com.helger.phase4.sender.AbstractAS4UserMessageBuilder.sendMessageAndCheckForReceipt(AbstractAS4UserMessageBuilder.java:712)
	at com.helger.phase4.sender.AbstractAS4UserMessageBuilder.sendMessageAndCheckForReceipt(AbstractAS4UserMessageBuilder.java:681)
	at com.helger.phase4.peppol.MainPhase4PeppolSender.main(MainPhase4PeppolSender.java:93)
661584 [main] ERROR com.helger.phase4.sender.AbstractAS4UserMessageBuilder - Exception sending AS4 user message
com.helger.phase4.util.Phase4Exception: Failed to parse incoming message!
	at com.helger.phase4.servlet.AS4IncomingHandler.parseAS4Message(AS4IncomingHandler.java:300)
	at com.helger.phase4.servlet.AS4IncomingHandler._parseMessage(AS4IncomingHandler.java:736)
	at com.helger.phase4.servlet.AS4IncomingHandler.parseSignalMessage(AS4IncomingHandler.java:764)
	at com.helger.phase4.sender.AS4BidirectionalClientHelper.sendAS4UserMessageAndReceiveAS4SignalMessage(AS4BidirectionalClientHelper.java:150)
	at com.helger.phase4.sender.AbstractAS4UserMessageBuilderMIMEPayload.mainSendMessage(AbstractAS4UserMessageBuilderMIMEPayload.java:123)
	at com.helger.phase4.sender.AbstractAS4MessageBuilder.sendMessage(AbstractAS4MessageBuilder.java:598)
	at com.helger.phase4.sender.AbstractAS4UserMessageBuilder.sendMessageAndCheckForReceipt(AbstractAS4UserMessageBuilder.java:712)
	at com.helger.phase4.sender.AbstractAS4UserMessageBuilder.sendMessageAndCheckForReceipt(AbstractAS4UserMessageBuilder.java:681)
	at com.helger.phase4.peppol.MainPhase4PeppolSender.main(MainPhase4PeppolSender.java:93)
661585 [main] INFO com.helger.phase4.peppol.MainPhase4PeppolSender - Peppol send result: TRANSPORT_ERROR
661586 [main] INFO com.helger.phase4.wss.WSSConfigManager - Cleaning up WSSConfig. Security Providers will also be removed.

and on the NC side:

[Mon Jun 27 14:58:35.977277 2022] [php7:notice] [pid 11] [client 192.168.64.5:39580] AS4 endpoint function was called!

@yasharpm
Copy link
Collaborator

yasharpm commented Jun 29, 2022

This is the response the phase4 sender receives from the peppolnext endpoint:

Date: Wed, 29 Jun 2022 11:17:37 GMT
Server: Apache/2.4.41 (Ubuntu)
Set-Cookie: ocyze4ttnob3=atbanlp9r1ohv89l1boae2hdga; path=/; secure; HttpOnly; SameSite=Lax
Set-Cookie: oc_sessionPassphrase=1vNvh3kk6TfQeGOzel%2FGr8u6T31hLJSBIBGunQmqFR9ss5c8z2G083KfHE12hdUC%2BcKIB1u%2BaspxQsQ4a9%2B3AkNECyPDNtYL8zYixnRCtVs1Izn31MRGdM0NMISdul3%2B; path=/; secure; HttpOnly; SameSite=Lax
Set-Cookie: ocyze4ttnob3=rbaqmp3ejl2q5m4t9mesdhuq2n; path=/; secure; HttpOnly; SameSite=Lax
Set-Cookie: __Host-nc_sameSiteCookielax=true; path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=lax
Set-Cookie: __Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=strict
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Content-Security-Policy: default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'
Referrer-Policy: no-referrer
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Permitted-Cross-Domain-Policies: none
X-Robots-Tag: none
X-XSS-Protection: 1; mode=block
X-Request-Id: UH0uzdqH5zviU0Rz5aVZ
Feature-Policy: autoplay 'none';camera 'none';fullscreen 'none';geolocation 'none';microphone 'none';payment 'none'
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: application/json; charset=utf-8

null

Notice null in the content. I am wondering why Content-Length header is missing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants