[MOBY-guts] biomoby commit
Dmitry Repchevski
drepchevski at dev.open-bio.org
Thu Feb 3 17:34:01 UTC 2011
drepchevski
Thu Feb 3 12:34:00 EST 2011
Update of /home/repository/moby/moby-live/Java/src/main/org/inb/biomoby/client
In directory dev.open-bio.org:/tmp/cvs-serv15343
Modified Files:
MobyDispatch.java
Log Message:
fixed argument parsing when it is specified as soap type instead of schema (string/base64Binary)
moby-live/Java/src/main/org/inb/biomoby/client MobyDispatch.java,1.2,1.3
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/inb/biomoby/client/MobyDispatch.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/Java/src/main/org/inb/biomoby/client/MobyDispatch.java 2010/08/31 16:15:44 1.2
+++ /home/repository/moby/moby-live/Java/src/main/org/inb/biomoby/client/MobyDispatch.java 2011/02/03 17:34:00 1.3
@@ -15,6 +15,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
+import javax.xml.XMLConstants;
import org.inb.biomoby.MobyMessageContext;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
@@ -61,6 +62,7 @@
import org.inb.wsrf.rp2.QueryResourceProperties;
import org.inb.wsrf.rp2.QueryResourcePropertiesResponse;
import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
/**
@@ -287,6 +289,37 @@
Node method = body.getFirstChild(); // check mobyService.getName() + "Response"?
Node argument = method.getFirstChild();
+ // fixing method argument type {http://schemas.xmlsoap.org/soap/encoding/}string => {http://www.w3.org/2001/XMLSchema}string
+ // Actually JAXB shouldn't support soap types in a first place...
+
+ NamedNodeMap attributes = argument.getAttributes();
+ if (attributes != null)
+ {
+ Node attribute = attributes.getNamedItemNS(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "type");
+
+ if (attribute != null)
+ {
+ String soapencPrefix = argument.lookupPrefix(SOAPConstants.URI_NS_SOAP_ENCODING);
+
+ if (soapencPrefix != null)
+ {
+ String type = attribute.getNodeValue();
+
+ if (type.startsWith(soapencPrefix))
+ {
+ String xsdPrefix = argument.lookupPrefix(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+
+ if (xsdPrefix != null)
+ {
+ type = xsdPrefix + type.substring(soapencPrefix.length());
+
+ attribute.setNodeValue(type);
+ }
+ }
+ }
+ }
+ }
+
Unmarshaller u = MobyMessageContext.getContext().createUnmarshaller();
JAXBElement jel = u.unmarshal(argument, byte[].class);
More information about the MOBY-guts
mailing list