I have Soap WS on Java.
Here is soap request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:his="SCC/Lis/HistoryFormatter">
<soapenv:Header/>
<soapenv:Body>
<his:formatHistoryByteArray>
<arg0>cid:anystring</arg0>
</his:formatHistoryByteArray>
</soapenv:Body>
</soapenv:Envelope>
FormatHistoryByteArray.class has only one field
@XmlElement(name = "arg0", namespace = "", nillable = true)
private byte[] arg0;
Type in *.xsd
<xs:complexType name="formatHistoryByteArray">
<xs:sequence>
<xs:element name="arg0" type="xs:base64Binary" nillable="true" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
WSDL and xsd is generated by JaxWS.
I cann’t understand logic of convertion string in node in request to byte[] in java-code. Help plz
cid: is the requared prefix or not?
Edited:
for example, if I have request
<arg0>abcdef</arg0>
in java code I get byte[] = {105, -73, 29}
How WebService get this byte array from string abcdef?
String.getBytes()returns you the (ASCII, UTF8, ISO-8859-1 etc.) encoding of a givenString. That’s different from what Base 64 is. Base 64 is a way of displaying arbitrary bytes as printable characters. So there is no reason for them to be the same.Have a look at section 2.1 of this tutorial on Base 64 and XML: http://www.xml.com/pub/a/2003/02/26/binaryxml.html. The base64 bit looks like this:
where
photoetc. are base64 elements.cidprefix is not needed.To address your question,
abcdefis being interpreted by the web service unmarshaller as a base-64 encoded string as the three bytes you received.