In order to pull events from Axis camera using ONVIF, I've created the following:
CreatePullPointSubscriptionResponse pullPointSubscriptionResponse = event.createPullPointSubscription(parameters);
PullPointSubscription pullPointSubscription = pullPointSubscriptionResponse.getSubscriptionReference().getPort(PullPointSubscription.class);
PullMessages pullMessagesParameters = new PullMessages();
pullMessagesParameters.setMessageLimit(1);
javax.xml.datatype.Duration duration = DatatypeFactory.createDuration("PT1M");
pullMessagesParameters.setTimeout(duration);
try {
PullMessagesResponse pullMessageResponse =
pullPointSubscription.pullMessages(pullMessagesParameters);
} catch (PullMessagesFaultResponse_Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
int d = 1;
catch(TopicNotSupportedFault | TopicExpressionDialectUnknownFault | InvalidTopicExpressionFault
| InvalidMessageContentExpressionFault | InvalidProducerPropertiesExpressionFault
| UnacceptableInitialTerminationTimeFault | NotifyMessageNotSupportedFault | ResourceUnknownFault
| UnsupportedPolicyRequestFault | InvalidFilterFault | SubscribeCreationFailedFault
| UnrecognizedPolicyRequestFault e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
My problem is that when pullMessages is executed, the web service is created with SOAP1.1, while the camera expects SOAP1.2 (I get version mismatch error response).
The createPullPointSubscription creates a good version web service, since I've created is with JaxWsProxyFactoryBean and i've set the binding myself. I cannot create the pull messages WS the same way, because I don't have the reference points that are encapsulated into the pullPointSubscription object (and they are private).
I'm looking for a way to let PullPointSubscription be aware of the current SOAP version, so I'll be able to receive the event response.
I've solved this problem in a bit of a workaround. I've extracted the private parameters from the response using .toString(), parsed the string, extracted the parameters, and created a new PullPointSubscription object with the right version and parameters.