| Last Modified On : | June 15, 2009 9:09 AM PDT |
Rate |
|
| July 21, 2009 9:39 AM PDT
Bill Somerville | P.S. Saw your forum post on this same issue. Any update from the engineers? |
| July 24, 2009 3:55 AM PDT
paul guermonprez |
Hello bill, The problem is coming from the encoding specification in the XML header (not the HTTP header). some AMT machines (recent firmware) need the utf-8 encoding specification in the XML header. (the encoding specification i nthe XML header is useless and not mandatory i nSOAP, but needed for some AMT machines ...) regards, paul |
| August 18, 2009 4:06 AM PDT
Hemant |
Hi Paul, Thanks for the insight in to Java code for Intel AMT. I am trying to get use HardwareAssetInterface to get hardware asset information. Below is what I am trying to (similar to the HelloAMT code provided by you). HardwareAssetService hardwareAssetService = new HardwareAssetService(); HardwareAssetSoapPortType hwAssetSoapPortType = (HardwareAssetSoapPortType) hardwar eAssetService.getHardwareAssetSoapPort(); ((BindingProvider) hwAssetSoapPortType).getRequestContext(). put(Binding Provider.ENDPOINT_ADDRESS_PROPERTY, "http://192.168.0.123:16992/HardwareAssetInterface"); Holder<Long> status = new Holder<Long>(); Holder<Long> count = new Holder<Long>(); Holder<AssetDataArrayType> assetData = new Holder<AssetDataArrayType>(); Long assetType = new Long(1); hwAssetSoapPortType.getAssetData(assetType, status, count, assetData); But I get the below exception in getAssetData() method: com.sun.xml.ws.client.ClientTransportException: HTTP Status-Code 404: Not Found - Not Found at com.sun.xml.ws.transport.http.client.HttpClientTransport.checkRes ponseCode(HttpClientTransport.java:219) I am using Intel Management Engine 5.1.0 Version. Could please anyone help on the same? Thanks in anticipation. Warm regards, Hemant Malik |
| August 25, 2009 1:26 AM PDT
jagadesan |
am using axis to get java file from wsdl its working for all the wsdl files in the (Intel amt sdk doc/wsdl) except the Remote accessAdmininterface.wsdl if i try to get the java file it give only four files Any help is needed thanks in Advanced |
| October 16, 2009 6:47 AM PDT
tgreben
|
Hi Bill, Here is the way how to make jax-ws to put "encoding" into xml header. 1. Create a decorator of XMLStreamWriter that enforces "encoding" to be put into xml header:
public class StreamWriter implements XMLStreamWriter {
private final XMLStreamWriter impl;
public StreamWriter(XMLStreamWriter impl) {
this.impl = impl;
}
public void writeStartDocument() throws XMLStreamException {
writeStartDocument("1.0");
}
public void writeStartDocument(String encoding, String version)
throws XMLStreamException {
impl.writeStartDocument(encoding, version);
}
public void writeStartDocument(String version)
throws XMLStreamException {
writeStartDocument("UTF-8", version);
}
//... (other XMLStreamWriter methods delegating to impl)
}
2. Create a decorator of XMLOutputFactory that returns decorated XMLStreamWriter where needed:
public class XMLOutputFactoryWithEncoding extends XMLOutputFactory {
private final XMLOutputFactory impl;
public XMLOutputFactoryWithEncoding(XMLOutputFactory impl) {
this.impl = (impl == null) ? XMLOutputFactory.newInstance() : impl;
}
public XMLStreamWriter createXMLStreamWriter(OutputStream stream,
String encoding) throws XMLStreamException {
return new StreamWriter(impl.createXMLStreamWriter(stream, encoding));
}
public XMLStreamWriter createXMLStreamWriter(OutputStream stream)
throws XMLStreamException {
return new StreamWriter(impl.createXMLStreamWriter(stream));
}
public XMLStreamWriter createXMLStreamWriter(Result result)
throws XMLStreamException {
return new StreamWriter(impl.createXMLStreamWriter(result));
}
public XMLStreamWriter createXMLStreamWriter(Writer stream)
throws XMLStreamException {
return new StreamWriter(impl.createXMLStreamWriter(stream));
}
//... (other XMLOutputFactory methods delegating to impl)
}
3. Create utility class for modifying default XMLStreamWriterFactory:
public class XMLStreamWriterFactoryModifier {
private static XMLStreamWriterFactory oldFactory = null;
private XMLStreamWriterFactoryModifier() {
}
/**
* @return <code>true</code> if factory was modified, otherwise <code>false</code>
*/
public static synchronized boolean modify() {
if(oldFactory != null) return false;
// Code below corresponds to static section of XMLStreamWriterFactory
XMLOutputFactory xof = null;
if (Boolean.getBoolean(XMLStreamWriterFactory.class.getName()+".wood stox")) {
try {
xof = (XMLOutputFactory)Class.forName("com.ctc.wstx.stax.WstxOutputFact ory").newInstance();
} catch (Exception e) {
// Ignore and fallback to default XMLOutputFactory
}
}
if (xof == null) {
xof = XMLOutputFactory.newInstance();
}
xof = new XMLOutputFactoryWithEncoding(xof);
XMLStreamWriterFactory f=null;
// this system property can be used to disable the pooling altogether,
// in case someone hits an issue with pooling in the production system.
if(!Boolean.getBoolean(XMLStreamWriterFactory.class.getName()+".n oPool")) {
f = XMLStreamWriterFactory.Zephyr.newInstance(xof);
}
if(f==null) {
// is this Woodstox?
if(xof.getClass().getName().equals("com.ctc.wstx.stax.WstxOutputF actory")) {
f = new XMLStreamWriterFactory.NoLock(xof);
}
}
if (f == null) {
f = new XMLStreamWriterFactory.Default(xof);
}
oldFactory = XMLStreamWriterFactory.get();
XMLStreamWriterFactory.set(f);
Logger.getLogger(XMLStreamWriterFactory.class.getName()).fine("XM LStreamWriterFactory instance is = "+f);
return true;
}
/**
* @return <code>true</code> if factory was restored to its previous state, otherwise <code>false</code>
*/
public static synchronized boolean rollback() {
if(oldFactory == null) return false;
XMLStreamWriterFactory.set(oldFactory);
Logger.getLogger(XMLStreamWriterFactory.class.getName()).fine("XM LStreamWriterFactory instance is = "+oldFactory);
return true;
}
}
4. Put the following line somewhere were application is initialized (e.g. as a first line in main() ): XMLStreamWriterFactoryModifier.modify(); Solution is tested and works on my environment. SOAP requests contain header with encoding="utf-8"and that makes AMT happy. :-) I don't have an option to attach source code here, so it is available upon request. Best regards, Taras. |

Paul Guermonprez (Intel)
|
Bill Somerville
I'm having a problem with AMT and JAX-WS that doesn't appear to be a problem in Axis. I'd prefer to use JAX-WS, since its footprint is smaller, but both your code and mine fail with the same problem.
I'm talking to an AMT 5.0.3 machine (Dell Optiplex 960). An exception is thrown:
javax.xml.ws.soap.SOAPFaultException: Failed to parse the request
(I had to add a SOAP fault handler to get around another JAX-WS problem where the default exception handler assumes that the fault namespace is not null).
This is with the latest JDK (1.6 update 12 and 13).
As I said, this works fine with Axis1, but for some reason, AMT doesn't seem to like the request sent by JAX-WS.
Thoughts?
Thanks...