I got soap project, thats works with xsd file. But I no idea how to work with soap. How i can work with xsd file like an object? What I need, get some data from database, set values to object, map to xsd file and sent to request with xsd file body XSD:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xro="http://x-road.eu/xsd/xroad.xsd" xmlns:iden="http://xroad.eu/xsd/identifiers" xmlns:erec="http://testrecord_service.x-road.ee/testrecord"> <soapenv:Header> <xro:protocolVersion>4.0</xro:protocolVersion> <xro:issue>123</xro:issue> <xro:id>123</xro:id> <xro:userId>123</xro:userId> <xro:service iden:objectType="SERVICE"> <iden:xRoadInstance>central-server</iden:xRoadInstance> <iden:memberClass>test</iden:memberClass> <iden:memberCode>test coed</iden:memberCode> <!--Optional:--> <iden:subsystemCode>test-service</iden:subsystemCode> <iden:serviceCode>testrecord</iden:serviceCode> <!--Optional:--> <iden:serviceVersion>v1</iden:serviceVersion> </xro:service> <xro:client iden:objectType="SUBSYSTEM"> <iden:xRoadInstance>test-server</iden:xRoadInstance> <iden:memberClass>test</iden:memberClass> <iden:memberCode>testcode</iden:memberCode> <!--Optional:--> <iden:subsystemCode>test-service</iden:subsystemCode> </xro:client> </soapenv:Header> <soapenv:Body> <erec:Authentication> <erec:companyIdentifier>cc93a8c3-465d-4813-a442- 69539692e0a1</erec:companyIdentifier> <erec:pin>12345</erec:pin> </erec:Authentication> </soapenv:Body> </soapenv:Envelope>
Advertisement
Answer
Oh .. I see xroad :). use maven-jaxb2-plugin to generate pojo models from xsd. Grab data from database, map it to pojo generated previously and pass it to the ws client
Beware that some xsd schemas of xroad are insufficient.
You’d better to hide authentication details from your question.